OK, I wrote Optionals for JDK8 which adds static functions map, flatMap, 
and toIterable

http://pastebin.com/HZ1suSRt
(I would probably adjust the generics type boundaries if this was a serious 
effort)

So that these work:

map(optObj, (o) -> ...);
flatMap(optObj, (o) -> ...);
for (T t : toIterable(optObj)) { ... }

For at least the first two, C#-style extension methods would offer more 
natural syntax, but I don't think that is a big deal:

optObj.map((o) -> ...);
optObj.flatMap((o) -> ...);

The major downside is that this will be another third-party add-on library 
and not built-in to the core standard library.

Will third party libraries -- mainly Functional Java but also others like 
Atlassian Fugue -- standardize on the JDK8 option and use static methods 
for the omitted features or will they continue to use completely separate 
Option class implementations?

-- 
You received this message because you are subscribed to the Google Groups "Java 
Posse" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/javaposse/-/9-5GnOv9VGUJ.
To post to this group, send email to javaposse@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to