Package org.agrona.collections
Class Int2IntHashMap.KeySet
- Enclosing class:
- Int2IntHashMap
Set of keys which supports optional cached iterators to avoid allocation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontains(int key) Checks if key is contained in the map without boxing.booleanbooleanisEmpty()iterator()booleanremoveIfInt(IntPredicate filter) Removes all the elements of this collection that satisfy the given predicate.intsize()Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAllMethods inherited from class java.util.AbstractCollection
add, addAll, containsAll, remove, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
add, addAll, containsAll, remove, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
KeySet
public KeySet()Create a new instance.
-
-
Method Details
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<Integer>- Specified by:
sizein interfaceSet<Integer>- Specified by:
sizein classAbstractCollection<Integer>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<Integer>- Specified by:
isEmptyin interfaceSet<Integer>- Overrides:
isEmptyin classAbstractCollection<Integer>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<Integer>- Specified by:
clearin interfaceSet<Integer>- Overrides:
clearin classAbstractCollection<Integer>
-
contains
- Specified by:
containsin interfaceCollection<Integer>- Specified by:
containsin interfaceSet<Integer>- Overrides:
containsin classAbstractCollection<Integer>
-
contains
public boolean contains(int key) Checks if key is contained in the map without boxing.- Parameters:
key- to check.- Returns:
trueif key is contained in this map.
-
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:
trueif at least one key was removed.
-