Java 8 Streams API - Stream-Level Predicates
Internal
Overview
These "match" operations apply a predicate to all elements of the stream, subject to short-circuiting, and return a boolean result. Any of these operations are terminal, in that they return a boolean (non-stream) result.
Methods
anyMatch
Returns whether any elements of this stream match the provided predicate. May not evaluate the predicate on all elements if not necessary for determining the result. If the stream is empty then false is returned and the predicate is not evaluated.
public interface Stream<T> ... {
boolean anyMatch(Predicate<? super T> predicate);
}
allMatch
Returns whether all elements of this stream match the provided predicate. May not evaluate the predicate on all elements if not necessary for determining the result. If the stream is empty then true is returned and the predicate is not evaluated.
public interface Stream<T> ... {
boolean allMatch(Predicate<? super T> predicate);
}
noneMatch
Returns whether no elements of this stream match the provided predicate. May not evaluate the predicate on all elements if not necessary for determining the result. If the stream is empty then true is returned and the predicate is not evaluated.
public interface Stream<T> ... {
boolean noneMatch(Predicate<? super T> predicate);
}