Package com.google.common.collect
Class ForwardingMap.StandardKeySet
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- com.google.common.collect.ForwardingMap.StandardKeySet
-
- All Implemented Interfaces:
Iterable<K>
,Collection<K>
,Set<K>
- Enclosing class:
- ForwardingMap<K extends @Nullable Object,V extends @Nullable Object>
protected class ForwardingMap.StandardKeySet extends AbstractSet<E>
A sensible implementation ofMap.keySet()
in terms of the following methods:ForwardingMap.clear()
,ForwardingMap.containsKey(java.lang.Object)
,ForwardingMap.isEmpty()
,ForwardingMap.remove(java.lang.Object)
,ForwardingMap.size()
, and theSet.iterator()
method ofForwardingMap.entrySet()
. In many cases, you may wish to overrideForwardingMap.keySet()
to forward to this implementation or a subclass thereof.- Since:
- 10.0
-
-
Constructor Summary
Constructors Constructor Description StandardKeySet()
Constructor for use by subclasses.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
contains(@Nullable Object o)
void
forEach(Consumer<? super K> action)
boolean
isEmpty()
Iterator<K>
iterator()
boolean
remove(@Nullable Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
-
Methods inherited from class java.util.AbstractSet
equals, hashCode
-
Methods inherited from class java.util.AbstractCollection
add, addAll, containsAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
add, addAll, containsAll, spliterator, toArray, toArray
-
-
-
-
Constructor Detail
-
StandardKeySet
public StandardKeySet()
Constructor for use by subclasses.
-
-
Method Detail
-
iterator
public Iterator<K> iterator()
-
forEach
public void forEach(Consumer<? super K> action)
-
size
public int size()
- Specified by:
size
in interfaceCollection<K extends @Nullable Object>
- Specified by:
size
in interfaceSet<K extends @Nullable Object>
- Specified by:
size
in classAbstractCollection<K extends @Nullable Object>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<K extends @Nullable Object>
- Specified by:
isEmpty
in interfaceSet<K extends @Nullable Object>
- Overrides:
isEmpty
in classAbstractCollection<K extends @Nullable Object>
-
contains
public boolean contains(@Nullable Object o)
- Specified by:
contains
in interfaceCollection<K extends @Nullable Object>
- Specified by:
contains
in interfaceSet<K extends @Nullable Object>
- Overrides:
contains
in classAbstractCollection<K extends @Nullable Object>
-
remove
public boolean remove(@Nullable Object o)
- Specified by:
remove
in interfaceCollection<K extends @Nullable Object>
- Specified by:
remove
in interfaceSet<K extends @Nullable Object>
- Overrides:
remove
in classAbstractCollection<K extends @Nullable Object>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<K extends @Nullable Object>
- Specified by:
clear
in interfaceSet<K extends @Nullable Object>
- Overrides:
clear
in classAbstractCollection<K extends @Nullable Object>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<E extends @Nullable Object>
- Specified by:
removeAll
in interfaceSet<E extends @Nullable Object>
- Overrides:
removeAll
in classAbstractSet<E extends @Nullable Object>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<E extends @Nullable Object>
- Specified by:
retainAll
in interfaceSet<E extends @Nullable Object>
- Overrides:
retainAll
in classAbstractCollection<E extends @Nullable Object>
-
-