Optional -> OptionalResult

Stephen Colebourne scolebourne at joda.org
Wed Jun 5 03:47:31 PDT 2013

On 5 June 2013 11:32, Mark Derricutt <mark at talios.com> wrote:
> I don't want to nitpick, but Map<Option<List<Foo>>>  isn't even a valid type for Map<K,V>
Thats why I use an IDE ;-)

> However, if Map had a method that returned an Optional<V>  if the value from absent from the map, say Map#find, Map#getOptional or Map#getResult you could train developers into not putting Optionals directly in the map to start with.
> Something like:
>    String name = map.getResult("firstName").or("");

I agree. In the return type position it works well. Given your
proposed method is getResult(), it suggests that the returned class
would make sense to be called Result<T>. Thats the real point of this


More information about the lambda-dev mailing list