java.lang.Object
java.util.AbstractMap<K,V>
org.meeuw.configuration.FixedSizeMap<K,V>
- All Implemented Interfaces:
Map<K,V>
A simple
Map implementation which allows for changing mappings, but not adding or deleting them.
This is used when representing configurations.
- Since:
- 0.4
- Author:
- Michiel Meeuwissen
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorsConstructorDescriptionFixedSizeMap(Map<K, V> wrapped) Instantiate this map with a given map of keys and values.FixedSizeMap(K... keys) Instantiate this map with the needed keys. -
Method Summary
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, toString, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
FixedSizeMap
Instantiate this map with a given map of keys and values. This will be wrapped, andFixedSizeMapwill disallow putting keys which are not already in it (or removing keys from it) -
FixedSizeMap
Instantiate this map with the needed keys. All values will initially benull
-
-
Method Details
-
of
Creates aFixedSizeMapand intializes all values.- Parameters:
keysAndValues- And even list of objects. Even entries are keys, odd entries are values.- Throws:
ClassCastException- If one of the objects it not of the correct typeIndexOutOfBoundsException- If the number of parameters is not even.
-
put
-
get
-
entrySet
-