Package net.shibboleth.shared.collection
Class ValueTypeIndexedMap<KeyType,ValueType>
java.lang.Object
net.shibboleth.shared.collection.ValueTypeIndexedMap<KeyType,ValueType>
- Type Parameters:
KeyType- the type of object used as keysValueType- the type of object stored as values
- All Implemented Interfaces:
Map<KeyType,ValueType>
public class ValueTypeIndexedMap<KeyType,ValueType>
extends Object
implements Map<KeyType,ValueType>
Map implementation which allows subsets of entries to be retrieved based on the type of the entry value.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classClass to represent null values. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.ValueTypeIndexedMap(Collection<Class<?>> newTypes) Constructor.ValueTypeIndexedMap(Map<KeyType, ValueType> newMap, Collection<Class<?>> newTypes) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleangetTypes()Get the value types that are indexed.inthashCode()booleanisEmpty()keySet()private booleanCheck if the object is of the specified type, taking null into account as well.voidvoidRebuild internal index.voidsetTypes(Collection<Class<?>> newTypes) Set which value types are indexed.intsize()Returns an unmodifiable map of the entries whose value is of the specified type.toString()values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
index
Storage for index of class -> members. -
map
Storage for map members. -
types
Set of valid types for this map.
-
-
Constructor Details
-
ValueTypeIndexedMap
public ValueTypeIndexedMap()Constructor. -
ValueTypeIndexedMap
public ValueTypeIndexedMap(@Nonnull Map<KeyType, ValueType> newMap, @Nonnull Collection<Class<?>> newTypes) Constructor.- Parameters:
newMap- existing map to build from.newTypes- collection of value types to index
-
ValueTypeIndexedMap
Constructor.- Parameters:
newTypes- collection of value types to index
-
-
Method Details
-
clear
public void clear() -
containsKey
- Specified by:
containsKeyin interfaceMap<KeyType,ValueType>
-
containsValue
- Specified by:
containsValuein interfaceMap<KeyType,ValueType>
-
entrySet
-
get
-
getTypes
Get the value types that are indexed.- Returns:
- which value types are indexed
-
isEmpty
public boolean isEmpty() -
keySet
-
matchType
Check if the object is of the specified type, taking null into account as well.- Parameters:
type- type to check forobject- object to check- Returns:
- true if the object is of the specified type
-
put
-
putAll
-
rebuildIndex
public void rebuildIndex()Rebuild internal index. -
remove
-
setTypes
Set which value types are indexed.- Parameters:
newTypes- which value types are indexed
-
size
public int size() -
subMap
Returns an unmodifiable map of the entries whose value is of the specified type.- Type Parameters:
SubType- type of values to include in the returned map- Parameters:
type- type of values to return- Returns:
- sub map of entries whose value is of type SubType or empty if the specified type is not a valid type for this map.
-
hashCode
public int hashCode() -
equals
-
toString
-
values
-