Closed GoogleCodeExporter closed 9 years ago
More workarounds potentially worth mentioning:
Optional.fromNullable(function.apply(value.orNull());
Alternately, users could just write a simple transformNullable(Optional,
Function) method themselves.
Should we maybe try to search within Google for potential users?
Original comment by lowas...@google.com
on 16 Oct 2012 at 3:51
Original comment by kak@google.com
on 22 Aug 2013 at 10:50
Just note: in JDK8's Optional.map the transformation of null result into
empty() is automatic.
See
http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/43386cc9a017/src/share/classes/jav
a/util/Optional.java line 215
IMHO accepting issue would make Guava usage easier for those who cannot move to
JDK8 now yet.
Original comment by tomas.za...@intelis.cz
on 13 Feb 2014 at 9:02
In reply to lowas/#1: The issue with your proposal is that the function then
needs to take into account getting a null value, which is a little annoying.
Original comment by jens.ran...@tink.se
on 9 Jul 2014 at 12:36
In what way? The above implementation (properly) just throws an NPE.
Original comment by lowas...@google.com
on 9 Jul 2014 at 4:19
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:13
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:18
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
tomas.za...@gmail.com
on 16 Oct 2012 at 2:03