O'Reilly logo
  • Bardia Aghabeigi thinks this is interesting:

The first is as elements, keys, and values in collections. You can’t put primitives in collections, so you’re forced to use boxed primitives. This is a special case of a more general one. You must use boxed primitives as type parameters in parameterized types (Chapter 5), because the language does not permit you to use primitives. For example, you cannot declare a variable to be of type Thread-Local<int>, so you must use ThreadLocal<Integer> instead. Finally, you must use boxed primitives when making reflective method invocations (

From

Cover of Effective Java, 2nd Edition

Note

APPLICATION OF BOX TYPES