私はブール要素のリストを持っています:
def list=[true,false,true,true]
次のような方法が存在するかどうかを尋ねます。
list.joinBoolean('&&')
< 偽
なぜなら: true && false && true && true=false
list.joinBoolean('||')
<真
理由:真|| || 偽 || || 真 || 真=真
存在しない場合、期待される結果を得るためにループを実行する方法を知っています。
と
boolean tmp=true;
list.each{e->
tmp=tmp && e;
}
return tmp;
また
boolean tmp=false;
list.each{e->
tmp=tmp || e;
}
return tmp;