Versions Compared

Key

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

...

The Integer class is only guaranteed to cache integer values from -128 to 127 to 128, which can result in equivalent values outside this range comparing as unequal when tested using the equality operators. For example, a JVM that did not cache any other values when running this program would output

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6a444d97b2561c60-e2222620-408d477b-85ebb77e-64103bd21e5676b8b15ed79f"><ac:plain-text-body><![CDATA[

[[Bloch 2009

AA. Bibliography#Bloch 09]]

4. "Searching for the One"

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="20835fd40af0fd3e-3d37de54-41c14f36-9be39211-e584f53b47ef72d0abc156e7"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[§5.1.7, "Boxing Conversion"

http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7]

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2c218bbac5b697c7-7bb02d93-4f4b449f-8a839dea-4dced9d60c9c45ae09594b36"><ac:plain-text-body><![CDATA[

[[Pugh 2009

AA. Bibliography#Pugh 09]]

Using == to compare objects rather than .equals

]]></ac:plain-text-body></ac:structured-macro>

...