Class CharacteristicTypeMap

All Implemented Interfaces:
Map<String,DefaultAttributeType<?>>

final class CharacteristicTypeMap extends AbstractMap<String,DefaultAttributeType<?>>
Implementation of the map returned by DefaultAttributeType.characteristics(). Information provided by this implementation are also used by CharacteristicMap.

Comparison with standard hash map

The straightforward approach would be to store the attributes directly as values in a standard HashMap. But instead of that, we store attributes in an array and the array indices in a HashMap. This level of indirection is useless if we consider only the DefaultAttributeType.characteristics() method, since a standard HashMap<String,AttributeType> would work as well or better. However, this level of indirection become useful for CharacteristicMap (the map returned by AbstractAttribute.characteristics()), since it allows a more efficient storage. We do this effort because some applications may create a very large amount of attribute instances.
Since:
0.5
Version:
0.8