Is there a simple way to check that any element is in the form of an iterable or iterator or not?
Instead of typing:
accessible
I would like to write:
interactive & lt; String & gt; Data = matching (); If (collections collection (data, my name)) {back true; }
I wonder if there is such a thing.
In Java 8, you renewable
to stream
And use anyMatch
on it:
string myName = ...; Iterable & LT; String & gt; Data = matching (); Return StreamSupport.stream (data.spliterator (), incorrect) .anymatch (name -> myName.equals (name));
Or using a method reference,
return stream support.stream (data.spliterator (), incorrect) .anymatch (myName :: equals );
Comments
Post a Comment