Package org.agrona.collections
Class Long2LongHashMap.KeySet
- Enclosing class:
Long2LongHashMap
Set of keys which supports optional cached iterators to avoid allocation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
contains
(long key) Checks if key is contained in the map without boxing.boolean
boolean
isEmpty()
iterator()
boolean
removeIfLong
(LongPredicate 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, remove, 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, remove, 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<Long>
- Specified by:
size
in interfaceSet<Long>
- Specified by:
size
in classAbstractCollection<Long>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Long>
- Specified by:
isEmpty
in interfaceSet<Long>
- Overrides:
isEmpty
in classAbstractCollection<Long>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<Long>
- Specified by:
clear
in interfaceSet<Long>
- Overrides:
clear
in classAbstractCollection<Long>
-
contains
- Specified by:
contains
in interfaceCollection<Long>
- Specified by:
contains
in interfaceSet<Long>
- Overrides:
contains
in classAbstractCollection<Long>
-
contains
public boolean contains(long key) Checks if key is contained in the map without boxing.- Parameters:
key
- to check.- Returns:
true
if key is contained in this map.
-
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:
true
if at least one key was removed.
-