Primitive streams and optional
Paul Sandoz
paul.sandoz at oracle.com
Tue Nov 27 02:22:02 PST 2012
On Nov 26, 2012, at 10:12 PM, Sam Pullara <spullara at gmail.com> wrote:
> I think I like 3 (or is this 4?) with additional methods that use suppliers for the cases where it isn't clear what we should do rather than Optional. Something like:
>
> T findFirst(Callable<T> notFound)
>
> Have we explored solutions like that? We could always override the method with one that has a well defined behavior in the miss case:
>
> T findFirst() // throws NoSuchElementException on failure
>
I still prefer having one method that returns a "thing" that can be used, uniformly and in a fluent-like manner, to do determine whether a result is available or absent.
Paul.
More information about the lambda-libs-spec-observers
mailing list