File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
devkit-utils/src/main/java/com/onixbyte/devkit/utils Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .onixbyte .devkit .utils ;
2+
3+ import java .util .Arrays ;
4+ import java .util .Objects ;
5+ import java .util .function .BooleanSupplier ;
6+
7+ public final class BoolUtil {
8+
9+ public static boolean and (Boolean ... values ) {
10+ return Arrays .stream (values )
11+ .filter (Objects ::nonNull )
12+ .allMatch (Boolean ::booleanValue );
13+ }
14+
15+ public static boolean and (BooleanSupplier ... valueSuppliers ) {
16+ return Arrays .stream (valueSuppliers )
17+ .filter (Objects ::nonNull )
18+ .allMatch (BooleanSupplier ::getAsBoolean );
19+ }
20+
21+ public static boolean or (Boolean ... valueSuppliers ) {
22+ return Arrays .stream (valueSuppliers )
23+ .filter (Objects ::nonNull )
24+ .anyMatch (Boolean ::booleanValue );
25+ }
26+
27+ public static boolean or (BooleanSupplier ... valueSuppliers ) {
28+ return Arrays .stream (valueSuppliers )
29+ .filter (Objects ::nonNull )
30+ .anyMatch (BooleanSupplier ::getAsBoolean );
31+ }
32+
33+ }
You can’t perform that action at this time.
0 commit comments