Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Boxed types are allowed to use the same instance for a range of integer values and consequently, suffer from the same problems as Boolean constants. If the primitive can be represented as a byte, the wrapper object is reused. Note that the boxed Integer primitive is shared and not the Integer object (new Integer(value)) itself. In general, holding a lock on any data structure that contains a boxed value is insecure.

...