Package com.globalmentor.collections
Interface MappedList<K,E>
- All Superinterfaces:
Collection<E>
,Iterable<E>
,List<E>
- All Known Implementing Classes:
DecoratorIDedMappedList
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object key) Returnstrue
if this map contains a mapping for the specified key.Returns the value to which this map maps the specified key.Removes the value from the list mapped to the given key value.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
Method Details
-
containsKey
Returnstrue
if this map contains a mapping for the specified key. More formally, returnstrue
if and only if this map contains a mapping for a keyk
such that(key==null ? k==null : key.equals(k))
. (There can be at most one such mapping.)- Parameters:
key
- key whose presence in this map is to be tested.- Returns:
true
if this map contains a mapping for the specified key.- Throws:
ClassCastException
- if the key is of an inappropriate type for this map (optional).NullPointerException
- if the key isnull
and this map does not permitnull
keys (optional).
-
get
Returns the value to which this map maps the specified key. Returnsnull
if the map contains no mapping for this key. A return value ofnull
does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key tonull
. ThecontainsKey
operation may be used to distinguish these two cases.More formally, if this map contains a mapping from a key
k
to a valuev
such that(key==null ? k==null : key.equals(k))
, then this method returnsv
; otherwise it returnsnull
. (There can be at most one such mapping.)- Parameters:
key
- key whose associated value is to be returned.- Returns:
- the value to which this map maps the specified key, or
null
if the map contains no mapping for this key. - Throws:
ClassCastException
- if the key is of an inappropriate type for this map (optional).NullPointerException
- if the key isnull
and this map does not permitnull
keys (optional).- See Also:
-
removeKey
Removes the value from the list mapped to the given key value.- Parameters:
key
- The key whose mapping is to be removed from the map and whose corresponding value is to be removed from the list.- Returns:
- previous value associated with specified key, or
null
if there was no mapping for key. - Throws:
ClassCastException
- if the key is of an inappropriate type for this mapped list (optional).NullPointerException
- if the key isnull
and this mapped list does not permitnull
keys (optional).UnsupportedOperationException
- if theremove
method is not supported by this mapped list.
-