現在、コードの可読性の問題に直面しています。問題は次のとおりです。
3つのオブジェクトを持つ
// initialization skipped, all of three could be null as result of their initalization
Object obj1;
Object obj2;
Object obj3;
次のように、それらから2つのブール値を作成したい:
// all are null
boolean bool1 = (obj1 == null && obj2 == null && obj3 == null);
// any of them is null
boolean bool2 = (obj1 == null || obj2 == null || obj3 == null);
guava がisNull
や などの組み込みの述語を提供することは知っていますnotNull
。
これら 2 つのブール値を満たすカスタム述語を実装する方法はありますか? .apply(..)
(その関数が3つのパラメータを取ると仮定すると)