Class AbstractMultiValuedMap.WrappedCollection
- java.lang.Object
-
- org.apache.commons.collections4.multimap.AbstractMultiValuedMap.WrappedCollection
-
- All Implemented Interfaces:
java.lang.Iterable<V>
,java.util.Collection<V>
- Direct Known Subclasses:
AbstractListValuedMap.WrappedList
,AbstractSetValuedMap.WrappedSet
- Enclosing class:
- AbstractMultiValuedMap<K,V>
class AbstractMultiValuedMap.WrappedCollection extends java.lang.Object implements java.util.Collection<V>
Wrapped collection to handle add and remove on the collection returned by get(object).Currently, the wrapped collection is not cached and has to be retrieved from the underlying map. This is safe, but not very efficient and should be improved in subsequent releases. For this purpose, the scope of this collection is set to package private to simplify later refactoring.
-
-
Constructor Summary
Constructors Constructor Description WrappedCollection(K key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(V value)
boolean
addAll(java.util.Collection<? extends V> other)
void
clear()
boolean
contains(java.lang.Object obj)
boolean
containsAll(java.util.Collection<?> other)
protected java.util.Collection<V>
getMapping()
boolean
isEmpty()
java.util.Iterator<V>
iterator()
boolean
remove(java.lang.Object item)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
int
size()
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
key
protected final K key
-
-
Constructor Detail
-
WrappedCollection
public WrappedCollection(K key)
-
-
Method Detail
-
getMapping
protected java.util.Collection<V> getMapping()
-
addAll
public boolean addAll(java.util.Collection<? extends V> other)
- Specified by:
addAll
in interfacejava.util.Collection<V>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<V>
-
iterator
public java.util.Iterator<V> iterator()
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<V>
-
contains
public boolean contains(java.lang.Object obj)
- Specified by:
contains
in interfacejava.util.Collection<V>
-
containsAll
public boolean containsAll(java.util.Collection<?> other)
- Specified by:
containsAll
in interfacejava.util.Collection<V>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<V>
-
remove
public boolean remove(java.lang.Object item)
- Specified by:
remove
in interfacejava.util.Collection<V>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<V>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<V>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<V>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfacejava.util.Collection<V>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-