[英]Null check vs Objects.requireNonNull in findFragmentByTag
[英]Generate constructor using fields including null check using Objects.requireNonNull(T obj) in Eclipse?
構造函數可以很容易地在 eclipse 中生成。 但是,能否以某種方式生成也執行空檢查的構造函數? 例子:
public class A {
private B b;
private C c;
//I need to auto-generate this type of constructor for many of my classes in Eclipse
public A(B b, C c) {
this.b = Objects.requireNonNull(b);
this.c = Objects.requireNonNull(c);
}
}
這可能嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.