Collection Design FAQ
Remi Forax
forax at univ-mlv.fr
Fri Sep 23 06:53:59 UTC 2016
On September 23, 2016 8:13:36 AM GMT+02:00, Kasper Nielsen <kasperni at gmail.com> wrote:
>Hi,
>
>I accidently bumped into an old friend today
>https://docs.oracle.com/javase/8/docs/technotes/guides/collections/designfaq.html
>There are couple of questions that might need an update after Java 8.
>Such
>as
>
>Why don't you provide an "apply" method in Collection to apply a given
>method ("upcall") to all the elements of the Collection?
Take a look to Iterable.forEach
>Why didn't you provide a "Predicate" interface, and related methods
>(e.g.,
>a method to find the first element in the Collection satisfying the
>predicate)?
predicate => java.util.function.Predicate
col.stream ().filter(predicate).findFirst ()
(or findAny())
it's on Stream because you can choose if you want a parallel operation or not.
>
>Best
> Kasper
Remi
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
More information about the core-libs-dev
mailing list