Package org.agrona.collections
Class Long2ObjectHashMap.KeySet
- Enclosing class:
- Long2ObjectHashMap<V>
Set of keys which supports optionally cached iterators to avoid allocation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontains(long key) Checks if the key is contained in the map.booleaniterator()booleanremove(long key) Removes key and the corresponding value from the map.booleanbooleanremoveIfLong(LongPredicate 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, isEmpty, 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, isEmpty, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
KeySet
public KeySet()Create a new instance.
-
-
Method Details
-
iterator
-
size
public int size()- Specified by:
sizein interfaceCollection<Long>- Specified by:
sizein interfaceSet<Long>- Specified by:
sizein classAbstractCollection<Long>
-
contains
- Specified by:
containsin interfaceCollection<Long>- Specified by:
containsin interfaceSet<Long>- Overrides:
containsin classAbstractCollection<Long>
-
contains
public boolean contains(long key) Checks if the key is contained in the map.- Parameters:
key- to check.- Returns:
trueif the key is contained in the map.
-
remove
- Specified by:
removein interfaceCollection<Long>- Specified by:
removein interfaceSet<Long>- Overrides:
removein classAbstractCollection<Long>
-
remove
public boolean remove(long key) Removes key and the corresponding value from the map.- Parameters:
key- to be removed.- Returns:
trueif the mapping was removed.
-
clear
public void clear()- Specified by:
clearin interfaceCollection<Long>- Specified by:
clearin interfaceSet<Long>- Overrides:
clearin classAbstractCollection<Long>
-
removeIfLong
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.
-