KeyType - the type of object used as keysValueType - the type of object stored as values@Beta
public class ValueTypeIndexedMap<KeyType,ValueType>
extends java.lang.Object
implements java.util.Map<KeyType,ValueType>
| Modifier and Type | Class and Description |
|---|---|
private static class |
ValueTypeIndexedMap.NullValue
Class to represent null values.
|
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.Class<?>,java.util.Map<KeyType,ValueType>> |
index
Storage for index of class -> members.
|
private java.util.Map<KeyType,ValueType> |
map
Storage for map members.
|
private java.util.Set<java.lang.Class<?>> |
types
Set of valid types for this map.
|
| Constructor and Description |
|---|
ValueTypeIndexedMap()
Constructor.
|
ValueTypeIndexedMap(java.util.Collection<java.lang.Class<?>> newTypes)
Constructor.
|
ValueTypeIndexedMap(java.util.Map<KeyType,ValueType> newMap,
java.util.Collection<java.lang.Class<?>> newTypes)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<KeyType,ValueType>> |
entrySet() |
boolean |
equals(java.lang.Object obj) |
ValueType |
get(java.lang.Object key) |
java.util.Set<java.lang.Class<?>> |
getTypes()
Get the value types that are indexed.
|
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<KeyType> |
keySet() |
private java.lang.Boolean |
matchType(java.lang.Class<?> type,
java.lang.Object object)
Check if the object is of the specified type, taking null into account as well.
|
ValueType |
put(KeyType key,
ValueType value) |
void |
putAll(java.util.Map<? extends KeyType,? extends ValueType> t) |
void |
rebuildIndex()
Rebuild internal index.
|
ValueType |
remove(java.lang.Object key) |
void |
setTypes(java.util.Collection<java.lang.Class<?>> newTypes)
Set which value types are indexed.
|
int |
size() |
<SubType extends ValueType> |
subMap(java.lang.Class<SubType> type)
Returns an unmodifiable map of the entries whose value is of the specified type.
|
java.lang.String |
toString() |
java.util.Collection<ValueType> |
values() |
private java.util.Map<java.lang.Class<?>,java.util.Map<KeyType,ValueType>> index
private java.util.Set<java.lang.Class<?>> types
public ValueTypeIndexedMap()
public ValueTypeIndexedMap(java.util.Map<KeyType,ValueType> newMap, java.util.Collection<java.lang.Class<?>> newTypes)
newMap - existing map to build from.newTypes - collection of value types to indexpublic ValueTypeIndexedMap(java.util.Collection<java.lang.Class<?>> newTypes)
newTypes - collection of value types to indexpublic boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public ValueType get(java.lang.Object key)
public java.util.Set<java.lang.Class<?>> getTypes()
public boolean isEmpty()
public java.util.Set<KeyType> keySet()
private java.lang.Boolean matchType(java.lang.Class<?> type,
java.lang.Object object)
type - type to check forobject - object to checkpublic void rebuildIndex()
public ValueType remove(java.lang.Object key)
public void setTypes(java.util.Collection<java.lang.Class<?>> newTypes)
newTypes - which value types are indexedpublic <SubType extends ValueType> java.util.Map<KeyType,SubType> subMap(java.lang.Class<SubType> type)
SubType - type of values to include in the returned maptype - type of values to returnpublic int hashCode()
public boolean equals(java.lang.Object obj)
public java.lang.String toString()
toString in class java.lang.Object