Package org.ovirt.engine.api.extensions
Class ExtMap
java.lang.Object
org.ovirt.engine.api.extensions.ExtMap
- All Implemented Interfaces:
Serializable,Cloneable,ConcurrentMap<ExtKey,,Object> Map<ExtKey,Object>
Type safe map.
Keys are bundle of uuid and type, each value added is checked against key
type.
- See Also:
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConcurrentMap<ExtKey, Object> Wrapped map.private static final long -
Constructor Summary
ConstructorsConstructorDescriptionExtMap()Constructs an empty ExtMap with the default initial capacity (16) and the default load factor (0.75).ExtMap(int initialCapacity) Constructs an empty ExtMap with the specified initial capacity and the default load factor (0.75).ExtMap(int initialCapacity, float loadFactor) Constructs an empty ExtMap with the specified initial capacity and load factor.Constructs a new ExtMap with the same mappings as the specified Map. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckKeyValue(ExtKey key, Object value) Check if value matches key type.voidclear()clone()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()boolean<T> TReturns the value to which the specified key is mapped, or null if this map contains no mapping for the key.<T> TReturns the value to which the specified key is mapped, or null if this map contains no mapping for the key.<T> TReturns the value to which the specified key is mapped, or null if this map contains no mapping for the key.<T> TReturns the value to which the specified key is mapped, or default.inthashCode()booleanisEmpty()keySet()Multiple putAll.Multiple put.voidputIfAbsent(ExtKey key, Object value) booleanbooleanintsize()toString()values()Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
map
Wrapped map. Wrapper and not inhertence per assumption of future exposure if interface changes.
-
-
Constructor Details
-
ExtMap
public ExtMap(int initialCapacity, float loadFactor) Constructs an empty ExtMap with the specified initial capacity and load factor.- Parameters:
initialCapacity- the initial capacity.loadFactor- the load factor.- Throws:
IllegalArgumentException- if the initial capacity is negative or the load factor is nonpositive.
-
ExtMap
public ExtMap(int initialCapacity) Constructs an empty ExtMap with the specified initial capacity and the default load factor (0.75).- Parameters:
initialCapacity- the initial capacity.- Throws:
IllegalArgumentException- if the initial capacity is negative or the load factor is nonpositive.
-
ExtMap
public ExtMap()Constructs an empty ExtMap with the default initial capacity (16) and the default load factor (0.75). -
ExtMap
Constructs a new ExtMap with the same mappings as the specified Map. The ExtMap is created with default load factor (0.75) and an initial capacity sufficient to hold the mappings in the specified Map.- Parameters:
m- the map whose mappings are to be placed in this map.- Throws:
NullPointerException- if the specified map is null.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
clone
-
toString
-
clear
public void clear() -
containsKey
- Specified by:
containsKeyin interfaceMap<ExtKey,Object>
-
containsValue
- Specified by:
containsValuein interfaceMap<ExtKey,Object>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size() -
values
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<ExtKey,Object> - Specified by:
putIfAbsentin interfaceMap<ExtKey,Object>
-
remove
-
replace
-
replace
-
mput
Multiple put. Usable for adding multiple entries:ExtMap = new ExtMap().mput(key1, value1).mput(key2, value2);- Parameters:
key- key with which the specified value is to be associated.value- value to be associated with the specified key.- Returns:
- this.
-
mput
Multiple putAll. Usable for adding multiple entries:ExtMap = new ExtMap().mputAll(map1).mputAll(map2);- Parameters:
m- map to add.- Returns:
- this.
-
get
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. Safe version of get().Integer i = <Integer> map.get(key1, Integer);- Type Parameters:
T- type of return and default value, inferred- Parameters:
key- key with which the specified value is to be associated.type- expected type.defaultValue- default value to return.- Returns:
- Value.
-
get
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. Safe version of get().- Type Parameters:
T- type of return value, inferred- Parameters:
key- key with which the specified value is to be associated.type- expected type.- Returns:
- Value.
- See Also:
-
get
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. Unsafe method of get with cast.Integer i = <Integer> map.get(key1);- Type Parameters:
T- type of return value- Parameters:
key- key.- Returns:
- Value.
-
get
Returns the value to which the specified key is mapped, or default. Unsafe method of get with cast.Integer i = <Integer> map.get(key1, 5);- Type Parameters:
T- type of return and default value, inferred- Parameters:
key- key.defaultValue- default value.- Returns:
- Value.
-
checkKeyValue
Check if value matches key type.
-