Package org.agrona.collections
Class Int2ObjectCache.KeySet
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<java.lang.Integer>
-
- org.agrona.collections.Int2ObjectCache.KeySet
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.Integer>
,java.util.Collection<java.lang.Integer>
,java.util.Set<java.lang.Integer>
- Enclosing class:
- Int2ObjectCache<V>
public final class Int2ObjectCache.KeySet extends java.util.AbstractSet<java.lang.Integer>
A key set implementation which supports cached iterator to avoid allocation.
-
-
Field Summary
Fields Modifier and Type Field Description private Int2ObjectCache.KeyIterator
iterator
-
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(int key)
Check if the given key contained in the set without boxing.boolean
contains(java.lang.Object o)
Int2ObjectCache.KeyIterator
iterator()
boolean
remove(java.lang.Object o)
boolean
removeIf(java.util.function.Predicate<? super java.lang.Integer> filter)
int
size()
-
Methods inherited from class java.util.AbstractCollection
add, addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
iterator
private final Int2ObjectCache.KeyIterator iterator
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<java.lang.Integer>
- Specified by:
size
in interfacejava.util.Set<java.lang.Integer>
- Specified by:
size
in classjava.util.AbstractCollection<java.lang.Integer>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<java.lang.Integer>
- Specified by:
contains
in interfacejava.util.Set<java.lang.Integer>
- Overrides:
contains
in classjava.util.AbstractCollection<java.lang.Integer>
-
contains
public boolean contains(int key)
Check if the given key contained in the set without boxing.- Parameters:
key
- to be checked.- Returns:
true
if key is contained in the cache.
-
iterator
public Int2ObjectCache.KeyIterator iterator()
- Specified by:
iterator
in interfacejava.util.Collection<java.lang.Integer>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Integer>
- Specified by:
iterator
in interfacejava.util.Set<java.lang.Integer>
- Specified by:
iterator
in classjava.util.AbstractCollection<java.lang.Integer>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<java.lang.Integer>
- Specified by:
remove
in interfacejava.util.Set<java.lang.Integer>
- Overrides:
remove
in classjava.util.AbstractCollection<java.lang.Integer>
-
removeIf
public boolean removeIf(java.util.function.Predicate<? super java.lang.Integer> filter)
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<java.lang.Integer>
- Specified by:
clear
in interfacejava.util.Set<java.lang.Integer>
- Overrides:
clear
in classjava.util.AbstractCollection<java.lang.Integer>
-
-