On Tue, 13 Nov 2018 at 15:44, Brian Goetz <brian.go...@oracle.com> wrote: > Yes, we know :) But we don’t have any current plans to do that, nor use-site > extension methods, nor does it seem likely to come to the top of the language > priority list very soon. So its not a choice between |> and .transform(); > it’s a choice between transform() and nothing. Picking transform() seems > pretty good here. > > Stephen raised the issue of a “broader context”; indeed, the intention of > adding a transform() method here was that it would be feasible to add to > other types for which it was suitable. String is an obvious candidate for > “do it first”, but this is within a broader context.
I'd be more comforted if there was a commitment to add the method to Stream and Optional in Java 12 or 13. I also agree with Remi that `transform()` is a poor name for Stream, and thus it is a poor name for String. I doubt there is a perfect name, process() or apply() seem like good candidates. Stephen