dimsuz
02/06/2017, 1:26 PMYou can also use explicit comparison of Boolean:
if (flag1 && (flag2 || someFlag == true))
More clean and native then elvis or extension functionWell, this would produce a different behavior compared to my examples. In my case
someFlag.orTrue() would resolve to true when someFlag == null, but in your example someFlag == true would resolve to false if this flag is null. I.e. .orTrue() and .orFalse() allow me to finetune behavior of null boolean values. This is rarely needed, but there are cases when this helps... Otherwise your suggestion in certainly nicer 🙂