...
Boolean.TRUE
, Boolean.FALSE
, or the values of autoboxed true
and false
literals may be compared using the reference equality operators because the Java language guarantees that the Boolean
type is fully memoized. Consequently, these objects are guaranteed to be singletons.
...
4, Searching for the One | |
[JLS 2005] | |
Using == to Compare Objects Rather than | |
[Seacord 2015] | EXP03-J. Do not use the equality operators when comparing values of boxed primitives LiveLesson |
...