Location of getStreamState [it2-bootstrap]

Brian Goetz brian.goetz at oracle.com
Tue Jul 31 07:42:57 PDT 2012


> Another question. It seems like moving the stream (or bulk) operations from
> Iterable to Streamable have caused one of them - groupBy - to not be lazy
> (if it ever was completely lazy). 

That's right.  There's very little value to it being lazy, and some value to it not being so.  (Think about how you would implement it; you have to pretty much build the whole map internally anyway; might as well return it then.)

> The return type of Streamable.groupBy is Map<U, Streamable<T>>. So, I guess
> it is either completely eager or half eager (for the keys) and half lazy
> (for the values). Which one is it ? If it is the latter, would the return
> type Map<U, Stream<T>> be more suitable ?

No.  Then you would only be able to traverse the values for a given key once.  

Stream : Streamble    as    Iterator : Iterable




More information about the lambda-dev mailing list