Package eu.bandm.tools.util.nonnull
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 keysR- the type of the values
- All Implemented Interfaces:
Nullfree,NonNullKeyMap<D,,R> NonNullMap<D,,R> NonNullValueMap<D,,R> Serializable,Cloneable,Map<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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionNonNullEnumMap(Class<D> d) Construct an empty EnumMap for the given enumeration type.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).NonNullEnumMap(Map<D, R> data) Creates an enum map initialized from the specified map. -
Method Summary
Methods inherited from class java.util.EnumMap
clear, clone, containsKey, containsValue, equals, get, hashCode, keySet, remove, size, valuesMethods inherited from class java.util.AbstractMap
isEmpty, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
NonNullEnumMap
Construct an empty EnumMap for the given enumeration type.- Parameters:
d- the class of the enumeration used as key valus.
-
NonNullEnumMap
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 mappingsNullPointerException- if data contains null values
-
NonNullEnumMap
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
-
entrySet
Deliver the set of entries. This class needs a special implementation of entrySet, Iterator, and Map.Entry for prohibiting setValue(null), -
asSorted
This method is required by the interface, but should never be called, since EnumMap are sorted anyhow. -
put
-
putAll
-