On 04/28/2015 03:05 PM, Paul Sandoz wrote:
[...]
I do understand the desire to control methods, but API design isn't
just about minimalism, it is also about meeting common use cases in a
natural way. The parallel is of course a standard if (obj instanceof
Foo) statement in Java, where develo
On Apr 28, 2015, at 11:18 AM, Stephen Colebourne wrote:
> On 27 April 2015 at 16:23, Paul Sandoz wrote:
>> One issue is there are zillions of possible more specific convenience
>> operations we could add. Everyone has their own favourite. Some static
>> methods were recently added to Stream and
On Apr 28, 2015, at 12:57 PM, Paul Sandoz wrote:
> Hi Peter,
>
> You are correct in stating that flatMap has some overhead.
>
> There are optimizations in place for operating on one element and on the head
> of the stream that reduce the overhead.
I believe at least in the micro-benchmark c
Hi Peter,
You are correct in stating that flatMap has some overhead.
There are optimizations in place for operating on one element and on the head
of the stream that reduce the overhead. Escape analysis sometimes works, it
would be nice if that were more reliable, and of course similar things
On 27 April 2015 at 16:23, Paul Sandoz wrote:
> One issue is there are zillions of possible more specific convenience
> operations we could add. Everyone has their own favourite. Some static
> methods were recently added to Stream and Optional in preference to such
> operations.
>
> There has t
On Apr 28, 2015, at 10:22 AM, Kasper Nielsen wrote:
> On Tue, Apr 28, 2015 at 9:16 AM, Paul Sandoz wrote:
> On Apr 27, 2015, at 10:34 PM, Kasper Nielsen wrote:
> > The other default function I would like to see is stream.toList() (I can
> > live with collectToList) which is short for s.collect
A couple of blog posts with the same issue.
http://winterbe.com/posts/2015/03/05/fixing-java-8-stream-gotchas-with-intellij-idea/
http://benjiweber.co.uk/blog/2015/03/06/adding-tolist-to-java-streams/
http://javarevisited.blogspot.dk/2015/03/5-ways-to-convert-java-8-stream-to-list.html
It is also
On Tue, Apr 28, 2015 at 9:16 AM, Paul Sandoz wrote:
> On Apr 27, 2015, at 10:34 PM, Kasper Nielsen wrote:
> > The other default function I would like to see is stream.toList() (I can
> > live with collectToList) which is short for
> s.collect(Collectors.toList()).
> > 50 % of my terminal functio
On Apr 27, 2015, at 10:34 PM, Kasper Nielsen wrote:
> The other default function I would like to see is stream.toList() (I can
> live with collectToList) which is short for s.collect(Collectors.toList()).
> 50 % of my terminal functions are s.collect(Collectors.toList()).
Can you live with a stat
On Mon, Apr 27, 2015 at 3:22 PM, Stephen Colebourne
wrote:
> This is a request for an additional method on java.util.stream.Stream.
>
> Having written quite a bit of code in Java 8 now, one annoyance keeps
> on coming up, filtering and casting the stream.
>
> Currently, it is necessary to do this
On 04/27/2015 05:23 PM, Paul Sandoz wrote:
On Apr 27, 2015, at 4:56 PM, Stephen Colebourne wrote:
Obviously, this is yet another possible workaround. But it is a
workaround.
I don't consider it "just a workaround" :-)
There really aren't that many rough edges with the set of
methods added
On Apr 27, 2015, at 4:56 PM, Stephen Colebourne wrote:
> Obviously, this is yet another possible workaround. But it is a
> workaround.
I don't consider it "just a workaround" :-)
> There really aren't that many rough edges with the set of
> methods added with lambdas, but this is definitely one
Obviously, this is yet another possible workaround. But it is a
workaround. There really aren't that many rough edges with the set of
methods added with lambdas, but this is definitely one. That Guava
handled it specially is another good indication.
BTW, I wait months before making this request to
Hi Stephen,
You can do this:
static Function> casting(Class c) { // bike shed for
clearer name
return o -> Stream.ofNullable(c.isInstance(o) ? c.cast(o) : null);
}
Object[] s = Stream.of(1, 2, "3", 4).toArray();
Stream.of(s).flatMap(casting(Integer.class)).
forEach(System.out::pri
This is a request for an additional method on java.util.stream.Stream.
Having written quite a bit of code in Java 8 now, one annoyance keeps
on coming up, filtering and casting the stream.
Currently, it is necessary to do this:
return input.stream()
.filter(Foo.class::isInstance)
15 matches
Mail list logo