Articles

In Java, boxed numbers are instances of classes, such as java.lang.Integer  or  java.lang.Double , that wrap or "box" the respective primitive types: int,  double, etc. They were designed to allow Java apps to pass around numbers as objects and, more importantly, to store numbers in the common collections, such as java.util.ArrayList,  java.util.HashMap, etc. The need to store numbers in lists and maps is very common. To satisfy it, the JDK developers had two choices:

  • Provide specialized collections, i.e. lists and maps, for every primitive type and their combinations. For example, this could include IntArrayListObjectToDoubleHashMap,  IntToObjectLinkedHashMap,  IntToLongConcurrentHashMap, etc.

    Source de l’article sur DZONE