Package org.agrona.collections
Class Int2ObjectHashMap.KeySet
- Enclosing class:
Int2ObjectHashMap<V>
Set of keys which supports optionally cached iterators to avoid allocation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
contains
(int key) Checks if the key is contained in the map.boolean
iterator()
boolean
remove
(int key) Removes key and the corresponding value from the map.boolean
boolean
removeIfInt
(IntPredicate filter) Removes all the elements of this collection that satisfy the given predicate.int
size()
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
add, addAll, containsAll, isEmpty, retainAll, 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, isEmpty, retainAll, spliterator, toArray, toArray
-
Field Details
-
keyIterator
-
-
Constructor Details
-
KeySet
public KeySet()Create a new instance.
-
-
Method Details
-
iterator
-
size
public int size()- Specified by:
size
in interfaceCollection<Integer>
- Specified by:
size
in interfaceSet<Integer>
- Specified by:
size
in classAbstractCollection<Integer>
-
contains
- Specified by:
contains
in interfaceCollection<Integer>
- Specified by:
contains
in interfaceSet<Integer>
- Overrides:
contains
in classAbstractCollection<Integer>
-
contains
public boolean contains(int key) Checks if the key is contained in the map.- Parameters:
key
- to check.- Returns:
true
if the key is contained in the map.
-
remove
- Specified by:
remove
in interfaceCollection<Integer>
- Specified by:
remove
in interfaceSet<Integer>
- Overrides:
remove
in classAbstractCollection<Integer>
-
remove
public boolean remove(int key) Removes key and the corresponding value from the map.- Parameters:
key
- to be removed.- Returns:
true
if the mapping was removed.
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<Integer>
- Specified by:
clear
in interfaceSet<Integer>
- Overrides:
clear
in classAbstractCollection<Integer>
-
removeIfInt
Removes all the elements of this collection that satisfy the given predicate.NB: Renamed from removeIf to avoid overloading on parameter types of lambda expression, which doesn't play well with type inference in lambda expressions.
- Parameters:
filter
- a predicate to apply.- Returns:
true
if at least one key was removed.
-