JavaPrimitiveTypesShouldBeObjects
Last edit August 29, 2005
[Voting on
JavaDesignFlaws
page.]
JavaLanguage
1.5 "autoboxes" primitive values. (See
BoxingConversions
and
http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html
.) That is, every time a primitive value is used where an object is required, the runtime system creates a new object to wrap the primitive value (and vice versa). This is almost, but not, the same as primitive types actually
being
objects. It is much less efficient, for one thing, especially in containers that store many values.
See
JavaPrimitiveTypesDiscussion