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

Reply via email to