--- /dev/null 2013-11-25 20:02:10.306908089 -0800 +++ new/src/share/classes/java/lang/doc-files/ValueBased.html 2013-12-03 14:17:06.365080344 -0800 @@ -0,0 +1,42 @@ + + +
+java.util.Optional
and
+java.time.LocalDateTime
, are value-based. Instances of a
+value-based class:
+equals
,
+ hashCode
, and toString
which are computed
+ solely from the instance's state and not from its identity or the state
+ of any other object or variable;==
) between instances, identity hash code of
+ instances, or synchronization on an instances's intrinsic lock;equals()
, not
+ based on reference equality (==
);x
and y
that are equal
+ according to equals()
in any computation or method
+ invocation should produce no visible change in behavior.
+ A program may produce unpredictable results if it attempts to distinguish two + references to equal values of a value-based class, whether directly via reference + equality or indirectly via an appeal to synchronization, identity hashing, + serialization, or any other identity-sensitive mechanism. Use of such + identity-sensitive operations on instances of value-based classes may have + unpredictable effects and should be avoided.
+ +