Shouldn't Optional be Serializable?
vitalyd at gmail.com
Tue Sep 17 16:32:48 PDT 2013
Presumably because you may want to have class fields that express
nullability via Optional rather than null. Whether that's a good design or
not is a separate question; conceptually, I don't see a reason why Optional
cannot support that. For "reference", Google Guava's version is
serializable. If someone were to replace their use with jdk's Optional
then they will hit exceptions if the owner class is serialized.
Sent from my phone
On Sep 17, 2013 6:06 PM, "Remi Forax" <forax at univ-mlv.fr> wrote:
> On 09/17/2013 11:44 PM, Pete Poulos wrote:
>> Shouldn't java.util.Optional be Serializable? Is there a good reason for
>> it not be?
> wrong question.
> the right one is why do you want Optional to be Serializable.
More information about the jdk8-dev