Streams

Doug Lea dl at cs.oswego.edu
Fri Sep 14 06:53:30 PDT 2012


On 09/14/12 09:15, David M. Lloyd wrote:
>  it's purely a
> style thing and it does have a cost.  I don't like it; I think it's going to
> result in things like:
>
> Map<String,Optional<List<Optional<String>>>>
>

You'd think there would be some nice compromise here of
offering multiple versions of only a few methods so that
people could avoid the propagation effects when the want/need to.
But when trying this out for CHM, I ended up thinking that
the only consistent design points are all-optional vs all-null.
So for example, CHM does not even support "filter" -- instead
you can supply indicator functions (as in: (x) -> pred(x) ? x : null)
in mappings and the nulls will be ignored.

But it may be worth breaking some consistency for
the sake of usability in supplying a few such choices
in Stream API. In particular, findAny
   Optional<T> findAny();
   T findAny(T ifNone);

-Doug



More information about the lambda-libs-spec-experts mailing list