Package org.agrona.collections
Class Long2ObjectHashMap.KeySet
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<java.lang.Long>
-
- org.agrona.collections.Long2ObjectHashMap.KeySet
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Long>
,java.util.Collection<java.lang.Long>
,java.util.Set<java.lang.Long>
- Enclosing class:
- Long2ObjectHashMap<V>
public final class Long2ObjectHashMap.KeySet extends java.util.AbstractSet<java.lang.Long>
Set of keys which supports optionally cached iterators to avoid allocation.
-
-
Field Summary
Fields Modifier and Type Field Description private Long2ObjectHashMap.KeyIterator
keyIterator
-
Constructor Summary
Constructors Constructor Description KeySet()
Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
contains(long key)
Checks if the key is contained in the map.boolean
contains(java.lang.Object o)
Long2ObjectHashMap.KeyIterator
iterator()
boolean
remove(long key)
Removes key and the corresponding value from the map.boolean
remove(java.lang.Object o)
boolean
removeIfLong(java.util.function.LongPredicate filter)
Removes all the elements of this collection that satisfy the given predicate.int
size()
-
Methods inherited from class java.util.AbstractCollection
add, addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
keyIterator
private final Long2ObjectHashMap.KeyIterator keyIterator
-
-
Method Detail
-
iterator
public Long2ObjectHashMap.KeyIterator iterator()
- Specified by:
iterator
in interfacejava.util.Collection<java.lang.Long>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Long>
- Specified by:
iterator
in interfacejava.util.Set<java.lang.Long>
- Specified by:
iterator
in classjava.util.AbstractCollection<java.lang.Long>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<java.lang.Long>
- Specified by:
size
in interfacejava.util.Set<java.lang.Long>
- Specified by:
size
in classjava.util.AbstractCollection<java.lang.Long>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<java.lang.Long>
- Specified by:
contains
in interfacejava.util.Set<java.lang.Long>
- Overrides:
contains
in classjava.util.AbstractCollection<java.lang.Long>
-
contains
public boolean contains(long 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
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<java.lang.Long>
- Specified by:
remove
in interfacejava.util.Set<java.lang.Long>
- Overrides:
remove
in classjava.util.AbstractCollection<java.lang.Long>
-
remove
public boolean remove(long 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 interfacejava.util.Collection<java.lang.Long>
- Specified by:
clear
in interfacejava.util.Set<java.lang.Long>
- Overrides:
clear
in classjava.util.AbstractCollection<java.lang.Long>
-
removeIfLong
public boolean removeIfLong(java.util.function.LongPredicate filter)
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.
-
-