Sorry, forgot to add link to the Flink discussion [1].
[1]
https://lists.apache.org/thread.html/f5f8ce92f94c9be6774340fbd7ae5e4afe07386b6765ad3cfb13aec0@%3Cdev.flink.apache.org%3E
On 8/21/19 10:08 PM, Jan Lukavský wrote:
Hi,
sorry if this discussion have been already taken, but I'd like to know
others opinions about how we use Optionals. The state in current
master is as follows:
$ git grep "import" | grep "java.util.Optional" | wc -l
85
$ git grep "import" | grep "Optional" | grep guava | wc -l
45
I'd like to propose that we use only one Optional, for consistency.
There are arguments towards using each one of them, if I try to sum
these up:
Pros for java.util:
* Part of standard lib
* Will (in the future) probably better integrate with other standard
APIs (e.g. Optional.stream in JDK 9, but probably more to come)
Pros for guava:
* Guava's Optional is Serializable
There was recently a discussion on Flink's mailing list [1], which
arrived at a conclusion, that using Optional as a field should be
discouraged (in favor of @Nullable). That would imply that
non-serializability of java.util.Optional is not an issue. But maybe
we can arrive at a different conclusion.
WDYT?
Jan