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="1c20c3f6ccde7bf0-e807b918-4cb44292-a23fb390-86915af02f0bde5a3070421c"><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="c301726d00dd226c-b9a6d471-4ee94bc5-85069ba8-7c7b45e39455c19cb33dcf92"><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="df74cfe8838f24e3-a3e3c7cb-40af4efe-a87ca852-147f1948bce0680084d9a6c6"><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>

...