java.lang.Object
com.aoapps.collections.PolymorphicMultimap<K,V>
A registry of objects by their class, along with all their parent classes
and interfaces, up to and including an upper bound. The registry is highly
concurrent, and performs registry lookups in O(1).
- Author:
- AO Industries, Inc.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetEntries
(Class<T> clazz) Gets all entries registered of the given class.getEntries
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets all entries registered of the given class that match the given filter.getEntriesFilterKey
(Class<T> clazz, Predicate<? super T> filter) Gets all entries registered of the given class that match the given filter.getEntriesFilterValue
(Class<T> clazz, Predicate<? super V> filter) Gets all entries registered of the given class that match the given filter.getFirstEntry
(Class<T> clazz) Gets the first entry registered of the given class.getFirstEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the first entry registered of the given class that match the given filter.getFirstEntryFilterKey
(Class<T> clazz, Predicate<? super T> filter) Gets the first entry registered of the given class that match the given filter.getFirstEntryFilterValue
(Class<T> clazz, Predicate<? super V> filter) Gets the first entry registered of the given class that match the given filter.<T extends K>
TgetFirstKey
(Class<T> clazz) Gets the first key registered of the given class.<T extends K>
TgetFirstKey
(Class<T> clazz, Predicate<? super T> filter) Gets the first key registered of the given class that match the given filter.<T extends K>
TgetFirstKeyFilterEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the first key registered of the given class that match the given filter.<T extends K>
TgetFirstKeyFilterValue
(Class<T> clazz, Predicate<? super V> filter) Gets the first key registered of the given class that match the given filter.getFirstValue
(Class<? extends K> clazz) Gets the first value registered of the given class.getFirstValue
(Class<? extends K> clazz, Predicate<? super V> filter) Gets the first value registered of the given class that match the given filter.getFirstValueFilterEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the first value registered of the given class that match the given filter.getFirstValueFilterKey
(Class<T> clazz, Predicate<? super T> filter) Gets the first value registered of the given class that match the given filter.Gets all keys registered of the given class.Gets all keys registered of the given class that match the given filter.getKeysFilterEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets all keys registered of the given class that match the given filter.getKeysFilterValue
(Class<T> clazz, Predicate<? super V> filter) Gets all keys registered of the given class that match the given filter.getLastEntry
(Class<T> clazz) Gets the last entry registered of the given class.getLastEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the last entry registered of the given class that match the given filter.getLastEntryFilterKey
(Class<T> clazz, Predicate<? super T> filter) Gets the last entry registered of the given class that match the given filter.getLastEntryFilterValue
(Class<T> clazz, Predicate<? super V> filter) Gets the last entry registered of the given class that match the given filter.<T extends K>
TgetLastKey
(Class<T> clazz) Gets the last key registered of the given class.<T extends K>
TgetLastKey
(Class<T> clazz, Predicate<? super T> filter) Gets the last key registered of the given class that match the given filter.<T extends K>
TgetLastKeyFilterEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the last key registered of the given class that match the given filter.<T extends K>
TgetLastKeyFilterValue
(Class<T> clazz, Predicate<? super V> filter) Gets the last key registered of the given class that match the given filter.getLastValue
(Class<? extends K> clazz) Gets the last value registered of the given class.getLastValue
(Class<? extends K> clazz, Predicate<? super V> filter) Gets the last value registered of the given class that match the given filter.getLastValueFilterEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the last value registered of the given class that match the given filter.getLastValueFilterKey
(Class<T> clazz, Predicate<? super T> filter) Gets the last value registered of the given class that match the given filter.protected <T extends K>
PolymorphicMultimap.Lists<T, V> Gets the lists registered for the given class.Gets all values registered of the given class.Gets all values registered of the given class that match the given filter.getValuesFilterEntry
(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets all values registered of the given class that match the given filter.getValuesFilterKey
(Class<T> clazz, Predicate<? super T> filter) Gets all values registered of the given class that match the given filter.void
Puts an key to the registry along with an associated value.
-
Constructor Details
-
PolymorphicMultimap
-
-
Method Details
-
put
Puts an key to the registry along with an associated value. The key is registered underall classes and interfaces
it extends and implements, up to and including the upper boundK
.This implementation favors lookup speed at O(1), and pays the price during
put(java.lang.Object, java.lang.Object)
. -
getLists
Gets the lists registered for the given class.- Returns:
- the lists or
null
when none registered
-
getKeys
Gets all keys registered of the given class. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class, or an empty list when none registered
-
getKeys
Gets all keys registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getKeysFilterValue
Gets all keys registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getKeysFilterEntry
public <T extends K> List<T> getKeysFilterEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets all keys registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getValues
Gets all values registered of the given class. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class, or an empty list when none registered
-
getValues
Gets all values registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getValuesFilterKey
Gets all values registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getValuesFilterEntry
public <T extends K> List<V> getValuesFilterEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets all values registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getEntries
Gets all entries registered of the given class. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class, or an empty list when none registered
-
getEntries
public <T extends K> List<Map.Entry<T,V>> getEntries(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets all entries registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getEntriesFilterKey
public <T extends K> List<Map.Entry<T,V>> getEntriesFilterKey(Class<T> clazz, Predicate<? super T> filter) Gets all entries registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getEntriesFilterValue
public <T extends K> List<Map.Entry<T,V>> getEntriesFilterValue(Class<T> clazz, Predicate<? super V> filter) Gets all entries registered of the given class that match the given filter. They are returned in the order registered. When an object is registered more than once, it will appear in the list multiple times. The list is a snapshot and will not change over time.- Returns:
- the unmodifiable list of all objects registered of the given class that match the filter, or an empty list when none registered
-
getFirstKey
Gets the first key registered of the given class.- Returns:
- the first key registered or
null
for none registered
-
getFirstKey
Gets the first key registered of the given class that match the given filter.- Returns:
- the first key registered that matches the filter or
null
for none registered
-
getFirstKeyFilterValue
Gets the first key registered of the given class that match the given filter.- Returns:
- the first key registered that matches the filter or
null
for none registered
-
getFirstKeyFilterEntry
public <T extends K> T getFirstKeyFilterEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the first key registered of the given class that match the given filter.- Returns:
- the first key registered that matches the filter or
null
for none registered
-
getFirstValue
Gets the first value registered of the given class.- Returns:
- the first value registered or
null
for none registered
-
getFirstValue
Gets the first value registered of the given class that match the given filter.- Returns:
- the first value registered that matches the filter or
null
for none registered
-
getFirstValueFilterKey
Gets the first value registered of the given class that match the given filter.- Returns:
- the first value registered that matches the filter or
null
for none registered
-
getFirstValueFilterEntry
public <T extends K> V getFirstValueFilterEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the first value registered of the given class that match the given filter.- Returns:
- the first value registered that matches the filter or
null
for none registered
-
getFirstEntry
Gets the first entry registered of the given class.- Returns:
- the first entry registered or
null
for none registered
-
getFirstEntry
public <T extends K> Map.Entry<T,V> getFirstEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the first entry registered of the given class that match the given filter.- Returns:
- the first entry registered that matches the filter or
null
for none registered
-
getFirstEntryFilterKey
public <T extends K> Map.Entry<T,V> getFirstEntryFilterKey(Class<T> clazz, Predicate<? super T> filter) Gets the first entry registered of the given class that match the given filter.- Returns:
- the first entry registered that matches the filter or
null
for none registered
-
getFirstEntryFilterValue
public <T extends K> Map.Entry<T,V> getFirstEntryFilterValue(Class<T> clazz, Predicate<? super V> filter) Gets the first entry registered of the given class that match the given filter.- Returns:
- the first entry registered that matches the filter or
null
for none registered
-
getLastKey
Gets the last key registered of the given class.- Returns:
- the last key registered or
null
for none registered
-
getLastKey
Gets the last key registered of the given class that match the given filter.- Returns:
- the last key registered that matches the filter or
null
for none registered
-
getLastKeyFilterValue
Gets the last key registered of the given class that match the given filter.- Returns:
- the last key registered that matches the filter or
null
for none registered
-
getLastKeyFilterEntry
public <T extends K> T getLastKeyFilterEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the last key registered of the given class that match the given filter.- Returns:
- the last key registered that matches the filter or
null
for none registered
-
getLastValue
Gets the last value registered of the given class.- Returns:
- the last value registered or
null
for none registered
-
getLastValue
Gets the last value registered of the given class that match the given filter.- Returns:
- the last value registered that matches the filter or
null
for none registered
-
getLastValueFilterKey
Gets the last value registered of the given class that match the given filter.- Returns:
- the last value registered that matches the filter or
null
for none registered
-
getLastValueFilterEntry
public <T extends K> V getLastValueFilterEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the last value registered of the given class that match the given filter.- Returns:
- the last value registered that matches the filter or
null
for none registered
-
getLastEntry
Gets the last entry registered of the given class.- Returns:
- the last entry registered or
null
for none registered
-
getLastEntry
public <T extends K> Map.Entry<T,V> getLastEntry(Class<T> clazz, Predicate<? super Map.Entry<T, V>> filter) Gets the last entry registered of the given class that match the given filter.- Returns:
- the last entry registered that matches the filter or
null
for none registered
-
getLastEntryFilterKey
public <T extends K> Map.Entry<T,V> getLastEntryFilterKey(Class<T> clazz, Predicate<? super T> filter) Gets the last entry registered of the given class that match the given filter.- Returns:
- the last entry registered that matches the filter or
null
for none registered
-
getLastEntryFilterValue
public <T extends K> Map.Entry<T,V> getLastEntryFilterValue(Class<T> clazz, Predicate<? super V> filter) Gets the last entry registered of the given class that match the given filter.- Returns:
- the last entry registered that matches the filter or
null
for none registered
-