Class EmptyIntSet
java.lang.Object
org.infinispan.commons.util.EmptyIntSet
Immutable empty IntSet
- Since:
- 9.3
- Author:
- wburns
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(int i) Adds the given int to this set and returnstrue
if it was set orfalse
if it was already presentboolean
boolean
addAll
(Collection<? extends Integer> c) boolean
Adds all ints from the provided set into this onevoid
clear()
boolean
contains
(int i) Whether this set contains the given intboolean
boolean
containsAll
(Collection<?> c) boolean
containsAll
(IntSet set) Whether this set contains all ints in the given IntSetboolean
static EmptyIntSet
A stream of ints representing the data in this setboolean
isEmpty()
iterator()
A primtive iterator that allows iteration over the int values.int
nextSetBit
(int fromIndex) Returns the next int in the set that is greater than or equal to the given value.boolean
remove
(int i) Removes, if present, the int from the set and returns if it was present or notboolean
boolean
removeAll
(Collection<?> c) boolean
Removes all ints from this IntSet that are in the provided IntSetboolean
removeIf
(IntPredicate filter) Removes all the ints of this set that satisfy the given predicate.boolean
boolean
retainAll
(Collection<?> c) boolean
Modifies this set to remove all ints that are not present in the provided IntSetvoid
set
(int i) Adds or sets the int without returning whether it was previously setint
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) byte[]
toBitSet()
Returns a byte array that has a bit set for each int in this set where each byte represents 8 numbers.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, toArray
Methods inherited from interface org.infinispan.commons.util.IntSet
forEach, intSpliterator, stream, toIntArray
Methods inherited from interface java.util.Set
hashCode, spliterator
-
Constructor Details
-
EmptyIntSet
public EmptyIntSet()
-
-
Method Details
-
getInstance
-
contains
public boolean contains(int i) Description copied from interface:IntSet
Whether this set contains the given int- Parameters:
i
- the int to check- Returns:
- if the set contains the int
-
containsAll
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
Description copied from interface:IntSet
A primtive iterator that allows iteration over the int values. This iterator supports removal if the set is modifiable.- Returns:
- the iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
containsAll
-
intStream
-
toBitSet
public byte[] toBitSet()Description copied from interface:IntSet
Returns a byte array that has a bit set for each int in this set where each byte represents 8 numbers. That is if the ints 2, 5 and 9 are set this will return a byte array consisting of 2 bytes in little-endian representation of those values.Depending upon the implementation this array may or may not have trailing bytes and may be condensed to save space.
- Returns:
- a byte array containing a little-endian representation of all the ints of this int set as bits
-
nextSetBit
public int nextSetBit(int fromIndex) Description copied from interface:IntSet
Returns the next int in the set that is greater than or equal to the given value.- Parameters:
fromIndex
- : inclusive index to start searching.- Returns:
- the index of the next set bit, or -1 if there is no such bit
-
equals
-
toString
-
add
-
set
-
remove
-
remove
-
removeAll
-
removeAll
-
retainAll
-
retainAll
-
add
-
addAll
-
addAll
-
clear
-
removeIf
- Specified by:
removeIf
in interfaceCollection<Integer>
-
removeIf
Description copied from interface:IntSet
Removes all the ints of this set that satisfy the given predicate. Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller. The default implementation traverses all elements of the collection using itsIntSet.iterator()
. Each matching element is removed usingIterator.remove()
. If the collection's iterator does not support removal then anUnsupportedOperationException
will be thrown on the first matching element.
-