--
--
guava-...@googlegroups.com
Project site: http://guava-libraries.googlecode.com
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: http://code.google.com/p/guava-libraries/issues/entry
To get help: http://stackoverflow.com/questions/ask (use the tag "guava")
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/7a7e1ef3-02c7-4013-8f81-4eaeeb80f156%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CAGB9EW-eyypHBfQXgUEJ5O6OhE-sS6Pni4%2BZ2G_O94M%2BxFmRbw%40mail.gmail.com.
But I can't chain my transformations :
Optional<C> cOpt = FluentIterable.from(listOfA).first().flatTransform(getB).flatTransform(getC);
I have to "flatten" myself each step separately with a custom flatOpt() :
public static <T> Optional<T> flatOpt(final Optional<Optional<T>> input) {
return (input.isPresent()) ? input.get() : Optional.<T> absent();
}
Optional<B> bOpt = flatOpt(FluentIterable.from(listOfA).first().transform(getB))
Optional<C> cOpt = flatOpt(bOpt.transform(getC));
it's not very clean, not in the "spirit" of Optional.
Regards,
Ronan.
I'm not sure why you wrote the functions that way, then, instead of as a normal Java method taking an Optional argument.
--
--
guava-...@googlegroups.com
Project site: http://guava-libraries.googlecode.com
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: http://code.google.com/p/guava-libraries/issues/entry
To get help: http://stackoverflow.com/questions/ask (use the tag "guava")
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/f9185b05-73d9-4196-9a49-ffd9829a869d%40googlegroups.com.
Optional<C> cOpt = FluentIterable.from(listOfA).first().flatTransform(getB).flatTransform(getC);
--
--
guava-...@googlegroups.com
Project site: http://guava-libraries.googlecode.com
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: http://code.google.com/p/guava-libraries/issues/entry
To get help: http://stackoverflow.com/questions/ask (use the tag "guava")
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/c2139ad3-175a-4c37-b7e0-390c26281a4c%40googlegroups.com.