Package com.iplanet.am.sdk
Class AMHashMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- com.sun.identity.common.CaseInsensitiveHashMap
-
- com.iplanet.am.sdk.AMHashMap
-
- All Implemented Interfaces:
Serializable,Cloneable,Map
public class AMHashMap extends CaseInsensitiveHashMap
This class will lower the case of the key that is used to access the HashMap. Primarily this implementation of HashMap is customized for storing and returning attributes. In the case of String values, the values are stored in a Set, whereas in case of byte values the values are stored as byte array. The special byte methods in this class should be used to do specific byte operations. This HashMap stores information about the type of values, (String or byte). All the operations are performed on this basis. The default case is that it stores String values. Note: For byte values there is no negative caching done.- See Also:
- Serialized Form
-
-
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>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEmptyValues(Set names)Method which adds new entries to the map with empty set as valuesvoidclear()protected voidclearNegativeByteAttrs()voidcopy(Map map)Copies the contents of the specified map to this map.SetcopyValuesOnly(Map map)Copies the contents of the specified map to this map.MapgetCopy()This method is to some what clone() behaviour.MapgetCopy(Set names)This method is to some what clone() behaviour.SetgetMissingAndEmptyKeys(Set keys)This compares all the elements of the specified and returns a Set which contains all the keys missing in the map and also those keys whose values are empty.SetgetMissingKeys(Set keys)This compares all the elements of the specified and returns a Set which contains all the keys missing in the map.SetgetNegativeByteAttrClone()booleanisByteValues()Checks whether this map contains byte array or string values.booleanisEmpty()voidmerge(Map map)Merges all the values from the specified map to the current map.voidremoveEmptyValues()Removes all the empty values (empty sets) from the map.voidremoveKeys(Set keys)protected voidsetNegativeByteAttr(Set n)-
Methods inherited from class com.sun.identity.common.CaseInsensitiveHashMap
containsKey, entrySet, get, keySet, put, putAll, remove
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsValue, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
-
-
-
Constructor Detail
-
AMHashMap
public AMHashMap()
-
AMHashMap
public AMHashMap(boolean forByteValues)
Creates a new AMHashMap- Parameters:
forByteValues- if true then, this map is used for storing byte values. if false, then used for storing String values
-
AMHashMap
public AMHashMap(int initialCapacity)
-
AMHashMap
public AMHashMap(int initialCapacity, boolean forByteValues)
-
AMHashMap
public AMHashMap(HashMap map)
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
clearNegativeByteAttrs
protected void clearNegativeByteAttrs()
-
setNegativeByteAttr
protected void setNegativeByteAttr(Set n)
-
getNegativeByteAttrClone
public Set getNegativeByteAttrClone()
-
getMissingKeys
public Set getMissingKeys(Set keys)
This compares all the elements of the specified and returns a Set which contains all the keys missing in the map. If a key is missing, this method adds puts a new element in this map with the missing key and empty Set.- Parameters:
keys- the Set of keys that will be compared against the keys in this map.- Returns:
- a set of keys which are missing
-
getMissingAndEmptyKeys
public Set getMissingAndEmptyKeys(Set keys)
This compares all the elements of the specified and returns a Set which contains all the keys missing in the map and also those keys whose values are empty. If a key is missing, this method adds puts a new element in this map with the missing key and empty Set.- Parameters:
keys- the Set of keys that will be compared against the keys in this map.- Returns:
- a set of keys which are missing and keys whose values are empty Sets.
-
removeKeys
public void removeKeys(Set keys)
-
copy
public void copy(Map map)
Copies the contents of the specified map to this map. This operation overwrites the values in this map.- Parameters:
map- the map that needs to be copied
-
copyValuesOnly
public Set copyValuesOnly(Map map)
Copies the contents of the specified map to this map. This operation overwrites the values in this map with new contents. This method copies only Sets with values and not empty sets. NOTE: This method will not worry about any negative attributes. Hence will be used in CacheBlock when the entries are being stored.- Parameters:
map- the map that needs to be copied- Returns:
- a set of attributes which have empty sets stored with them
-
merge
public void merge(Map map)
Merges all the values from the specified map to the current map. Adds new values into the current map if not already present. The method assumes that the values in the map are of Set type.- Parameters:
map- the map whose values need to merge and added to the current map.- Throws:
NullPointerException- if the map is null.
-
addEmptyValues
public void addEmptyValues(Set names)
Method which adds new entries to the map with empty set as values- Parameters:
names- new entries to be added to the map
-
removeEmptyValues
public void removeEmptyValues()
Removes all the empty values (empty sets) from the map.
-
getCopy
public Map getCopy()
This method is to some what clone() behaviour. However, this AMHashMap is designed to mostly store attribute names as keys and Set of values corresponding to each key, a new protected method has been created for this purpose.- Returns:
- a new AMHashMap that has a copy of all the elements in this map
-
getCopy
public Map getCopy(Set names)
This method is to some what clone() behaviour. However, this AMHashMap is designed to mostly store attribute names as keys and Set of values corresponding to each key, a new protected method has been created for this purpose.- Parameters:
names- the names of the attributes that need to be obtained from Map- Returns:
- a new AMHashMap that has a copy of all the elements in this map
-
isByteValues
public boolean isByteValues()
Checks whether this map contains byte array or string values.- Returns:
- true if the type of values is
byte[][]otherwise false.
-
-