- allMatch operation on stream returns true if all items in stream satisfy predicate function.
intStream one to three
IntStream oneToThree = IntStream.of(1, 2, 3);
USAGE
BiFunction<Stream<Integer>, Predicate<Integer>, Boolean> allMatch =
(stream, predicate) -> stream.allMatch(predicate);
log.info("all numbers in oneToThree Integer stream are greater than zero: " +
allMatch.apply(oneToThree.boxed(), number -> number > 0)
);
Comments
Post a comment