RFR: 8180352: Add Stream.toList() method

Justin Dekeyser justin.dekeyser at gmail.com
Wed Nov 4 10:00:33 UTC 2020


Hello,

Ah that's a super good news, thanks a lot for sharing !
I dream of this since 2 years <3

Best regards,

Justin Dekeyser


On Wed, Nov 4, 2020 at 10:24 AM Tagir Valeev <amaembo at gmail.com> wrote:
>
> Hello!
>
> On Wed, Nov 4, 2020 at 4:16 PM Justin Dekeyser
> <justin.dekeyser at gmail.com> wrote:
> > What about trying to make the Stream interface *flexible* to users,
> > instead of adding new functionalities that we could regret later?
> > Then, as the language usages and the trends evolve, we could really
> > see which of the "utils" functions are relevant to add.
> >
> > For example, we could maybe invent a method of the form (just a
> > sketch, not an actual well thought proposal)
> > `
> > default <S extends Stream<T>> S wrap(Function<Stream<T>, S> wrapper) {
> >    return wrapper.apply(this);
> > }
> > `
> > on Stream<T> interface, in such a way one could use the "natural flow"
> > of writing while binding its own implementation and, therefore, use
> > its own shortcuts.
>
> See https://bugs.openjdk.java.net/browse/JDK-8210372
> (also, String::transform)
>
> With best regards,
> Tagir Valeev


More information about the core-libs-dev mailing list