Class NonNullEnumMap<D extends Enum<D>,R>

java.lang.Object
java.util.AbstractMap<D,R>
java.util.EnumMap<D,R>
eu.bandm.tools.util.nonnull.NonNullEnumMap<D,R>
Type Parameters:
D - the type of the keys
R - the type of the values
All Implemented Interfaces:
Nullfree, NonNullKeyMap<D,R>, NonNullMap<D,R>, NonNullValueMap<D,R>, Serializable, Cloneable, Map<D,R>

public class NonNullEnumMap<D extends Enum<D>,R> extends EnumMap<D,R> implements NonNullMap<D,R>
Implements an enumeration map which is strict in values. (EnumMap is strict in its keys anyhow.) The implementation is done by delegation to some peer object from a predefined Java runtime class.
See Also:
  • Constructor Details

    • NonNullEnumMap

      public NonNullEnumMap(Class<D> d)
      Construct an empty EnumMap for the given enumeration type.
      Parameters:
      d - the class of the enumeration used as key valus.
    • NonNullEnumMap

      public NonNullEnumMap(Map<D,R> data)
      Creates an enum map initialized from the specified map. If the specified map is an EnumMap instance, this constructor behaves identically to EnumMap(EnumMap). Otherwise, the specified map must contain at least one mapping (in order to determine the new enum map's key type).
      Parameters:
      data - the map from which to initialize this enum map
      Throws:
      IllegalArgumentException - if m is not an EnumMap instance and contains no mappings
      NullPointerException - if data contains null values
    • NonNullEnumMap

      public NonNullEnumMap(EnumMap<D,R> data)
      Creates an enum map with the same key type as the specified enum map, initially containing the same mappings (if any).
      Parameters:
      data - the enum map from which to initialize this enum map
      Throws:
      NullPointerException - if m is null
  • Method Details