3 ms·
edit: this is wrong, I was misreading the documentation, which states that the Optional class is a value type, not the contents of the Optional class. Accordin
by dsp1234 10y ago
edit: this is wrong, I was misreading the documentation, which states that the Optional class is a value type, not the contents of the Optional class.
According the documentation, Optional is only valid with value types[0]:
"This is a value-based class; use of identity-sensitive operations (including reference equality (==), identity hash code, or synchronization) on instances of Optional may have unpredictable results and should be avoided."
Again, I have no experience, so if this is wrong, then additional corrective references would be awesome.
[0] - https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html https://docs.oracle.com/javase/8/docs/api/java/util/Optional...