Optional -> OptionalResult
Mark Derricutt
mark at talios.com
Wed Jun 5 03:32:09 PDT 2013
I don't want to nitpick, but Map<Option<List<Foo>>> isn't even a valid type for Map<K,V>, the least your have would be Map<K,Option<List<Foo>>, IMHO this would actually be valid in the case where you need to disambiguate an empty list, from NO list.
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("");
reads quite well.
Jed Wesley-Smith wrote:
> Map<Option<List<Foo>>> is clearly a straw-man. It does not make any sense
> to have a Map that has an optional key,
More information about the lambda-dev
mailing list