Versions Compared

Key

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

...

Wiki Markup
Autoboxing automatically wraps a value of a primitive type with the corresponding wrapper object. The _Java Language Specification_ (JLS) [§5.1.7, "Boxing Conversion,"|http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7] \[[JLS 2005|AA. Bibliography#JLSReferences#JLS 05]\], explains which primitive values are memoized during autoboxing: 

...

Wiki Markup
This noncompliant code example defines a {{Comparator}} with a {{compare()}} method \[[Bloch 2009|AA. Bibliography#BlochReferences#Bloch 09]\]. The {{compare()}} method accepts two boxed primitives as arguments. The {{==}} operator is used to compare the two boxed primitives. In this context, however, it compares the _references_ to the wrapper objects rather than comparing the _values_ held in those objects. 

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1f840a568abd97f7-1b8b25a0-4c424573-993dbbee-8a73cb5f34a68db4db3c1254"><ac:plain-text-body><![CDATA[

[[Bloch 2009

AA. Bibliography#Bloch References#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="52146c921fed58b4-a3d218c8-45c34bf9-b00184e8-c15ce8f3c29973d188965258"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS References#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="0963dee9fe804a7d-8e22403e-472547ba-9d6ea47a-23015af177ab70d422acf492"><ac:plain-text-body><![CDATA[

[[Pugh 2009

AA. Bibliography#Pugh References#Pugh 09]]

Using == to Compare Objects Rather than .equals

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

...