List<String> list = new ArrayList<>();
boolean a = list.stream().anyMatch("a"::equals); // If the stream is empty then false is returned and the predicate is not evaluated.
boolean b = list.stream().allMatch("b"::equals); // If the stream is empty then true is returned and the predicate is not evaluated.
boolean c = list.stream().noneMatch("c"::equals); // If the stream is empty then true is returned and the predicate is not evaluated.
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);
标签:Stream,stream,记录,一下,list,System,boolean,empty,out
From: https://www.cnblogs.com/qbbit/p/16876772.html