KeyType - the type of object used as keysValueType - the type of object stored as valuespublic class ValueTypeIndexedMap<KeyType,ValueType> extends Object implements 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 Map<Class<?>,Map<KeyType,ValueType>> |
index
Storage for index of class -> members.
|
private Map<KeyType,ValueType> |
map
Storage for map members.
|
private Set<Class> |
types
Set of valid types for this map.
|
| Constructor and Description |
|---|
ValueTypeIndexedMap()
Constructor.
|
ValueTypeIndexedMap(Collection<Class> newTypes)
Constructor.
|
ValueTypeIndexedMap(Map<KeyType,ValueType> newMap,
Collection<Class> newTypes)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<KeyType,ValueType>> |
entrySet() |
ValueType |
get(Object key) |
Set<Class> |
getTypes()
Get the value types that are indexed.
|
boolean |
isEmpty() |
Set<KeyType> |
keySet() |
private Boolean |
matchType(Class<?> type,
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(Map<? extends KeyType,? extends ValueType> t) |
void |
rebuildIndex()
Rebuild internal index.
|
ValueType |
remove(Object key) |
void |
setTypes(Collection<Class> newTypes)
Set which value types are indexed.
|
int |
size() |
<SubType extends ValueType> |
subMap(Class<SubType> type)
Returns an unmodifiable map of the entries whose value is of the specified type.
|
String |
toString() |
Collection<ValueType> |
values() |
public ValueTypeIndexedMap()
public ValueTypeIndexedMap(Map<KeyType,ValueType> newMap, Collection<Class> newTypes)
newMap - existing map to build from.newTypes - collection of value types to indexpublic ValueTypeIndexedMap(Collection<Class> newTypes)
newTypes - collection of value types to indexpublic boolean containsKey(Object key)
containsKey in interface Map<KeyType,ValueType>public boolean containsValue(Object value)
containsValue in interface Map<KeyType,ValueType>public Set<Class> getTypes()
private Boolean matchType(Class<?> type, Object object)
type - type to check forobject - object to checkpublic void rebuildIndex()
public void setTypes(Collection<Class> newTypes)
newTypes - which value types are indexedpublic <SubType extends ValueType> Map<KeyType,SubType> subMap(Class<SubType> type)
SubType - type of values to include in the returned maptype - type of values to returnCopyright © 1999-2015. All Rights Reserved.