@Beta protected class ForwardingMap.StandardValues extends java.util.AbstractCollection<V>
Map.values()
in terms of the following methods: ForwardingMap.clear()
, ForwardingMap.containsValue(java.lang.Object)
, ForwardingMap.isEmpty()
,
ForwardingMap.size()
, and the Set.iterator()
method of ForwardingMap.entrySet()
. In many cases, you may wish to override ForwardingMap.values()
to forward to this implementation or a subclass thereof.Constructor and Description |
---|
StandardValues()
Constructor for use by subclasses.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all of the elements from this collection (optional operation).
|
boolean |
contains(java.lang.Object o)
Returns true if this collection contains the specified element.
|
void |
forEach(java.util.function.Consumer<? super V> action)
Performs the given action for each element of the
Iterable
until all elements have been processed or the action throws an
exception. |
boolean |
isEmpty()
Returns true if this collection contains no elements.
|
java.util.Iterator<V> |
iterator()
Returns an iterator over the elements contained in this collection.
|
boolean |
remove(java.lang.Object o)
Removes a single instance of the specified element from this
collection, if it is present (optional operation).
|
boolean |
removeAll(java.util.Collection<?> c)
Removes all of this collection's elements that are also contained in the
specified collection (optional operation).
|
boolean |
retainAll(java.util.Collection<?> c)
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
int |
size()
Returns the number of elements in this collection.
|
add, addAll, containsAll, toArray, toArray, toString
public StandardValues()
public java.util.Iterator<V> iterator()
java.util.AbstractCollection
iterator
in interface java.lang.Iterable<V>
iterator
in interface java.util.Collection<V>
iterator
in class java.util.AbstractCollection<V>
public void forEach(java.util.function.Consumer<? super V> action)
java.lang.Iterable
Iterable
until all elements have been processed or the action throws an
exception. Unless otherwise specified by the implementing class,
actions are performed in the order of iteration (if an iteration order
is specified). Exceptions thrown by the action are relayed to the
caller.action
- The action to be performed for each elementpublic boolean remove(java.lang.Object o)
java.util.AbstractCollection
This implementation iterates over the collection looking for the specified element. If it finds the element, it removes the element from the collection using the iterator's remove method.
Note that this implementation throws an UnsupportedOperationException if the iterator returned by this collection's iterator method does not implement the remove method and this collection contains the specified object.
remove
in interface java.util.Collection<V>
remove
in class java.util.AbstractCollection<V>
o
- element to be removed from this collection, if presentpublic boolean removeAll(java.util.Collection<?> c)
java.util.AbstractCollection
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements in common with the specified collection.
removeAll
in interface java.util.Collection<V>
removeAll
in class java.util.AbstractCollection<V>
c
- collection containing elements to be removed from this collectionAbstractCollection.remove(Object)
,
AbstractCollection.contains(Object)
public boolean retainAll(java.util.Collection<?> c)
java.util.AbstractCollection
This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's not so contained, it's removed from this collection with the iterator's remove method.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method and this collection contains one or more elements not present in the specified collection.
retainAll
in interface java.util.Collection<V>
retainAll
in class java.util.AbstractCollection<V>
c
- collection containing elements to be retained in this collectionAbstractCollection.remove(Object)
,
AbstractCollection.contains(Object)
public int size()
java.util.Collection
size
in interface java.util.Collection<V>
size
in class java.util.AbstractCollection<V>
public boolean isEmpty()
java.util.AbstractCollection
This implementation returns size() == 0.
isEmpty
in interface java.util.Collection<V>
isEmpty
in class java.util.AbstractCollection<V>
public boolean contains(@NullableDecl java.lang.Object o)
java.util.AbstractCollection
This implementation iterates over the elements in the collection, checking each element in turn for equality with the specified element.
contains
in interface java.util.Collection<V>
contains
in class java.util.AbstractCollection<V>
o
- element whose presence in this collection is to be testedpublic void clear()
java.util.AbstractCollection
This implementation iterates over this collection, removing each element using the Iterator.remove operation. Most implementations will probably choose to override this method for efficiency.
Note that this implementation will throw an UnsupportedOperationException if the iterator returned by this collection's iterator method does not implement the remove method and this collection is non-empty.
clear
in interface java.util.Collection<V>
clear
in class java.util.AbstractCollection<V>
Copyright © 2010–2019 JBoss by Red Hat. All rights reserved.