Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java stream anymatch vs findany

They do the same job internally, but their return value is different.
Stream#anyMatch() returns a boolean while Stream#findAny() returns an object
which matches the predicate.
anyMatch is a short-circuit operation, but filter will always process the whole
stream
 
PREVIOUS NEXT
Tagged: #java #stream #anymatch #findany
ADD COMMENT
Topic
Name
6+2 =