A map operation that removes empties is generally called a flatMap, because it flattens while it maps, so you get Foo<Bar> instead of Foo<Baz<Bar>>. It's helpful to call a map a map, and a flatMap a flatMap, just to have some common terminology.
On Fri, Jul 6, 2012 at 8:37 AM, Dale Wijnand <[email protected]> wrote: > Of course you can map a List<A> to a List<Optional<B>> via your mapping > method, however I don't see why you would return that List<Optional<B>>, > just return List<B> with the non-present optionals removed. > > On Friday, July 6, 2012 1:28:27 PM UTC+2, Reinier Zwitserloot wrote: >> >> >> >> On Friday, July 6, 2012 1:12:18 PM UTC+2, Dale Wijnand wrote: >>> >>> On the fly I can't think of a reason to return a List<Option<T>>, that's >>> just ridiculous. >>> >>> >> Why is that ridiculous? If I have a method which emits an Option<T>, and >> I have a list of inputs and I run a map operation, I'll get a >> List<Option<T>> out. Either Option is part of the type system (which also >> means it can be used in generics too), or it's not. There's no halfwaysies >> on this, IMO. >> > -- > 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/-/3NZ0gDscvlQJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
