Class RangeSet
java.lang.Object
org.infinispan.commons.util.RangeSet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int i) Adds the given int to this set and returnstrueif it was set orfalseif it was already presentbooleanbooleanaddAll(Collection<? extends Integer> c) booleanAdds all ints from the provided set into this onevoidclear()booleancontains(int i) Whether this set contains the given intbooleanbooleancontainsAll(Collection<?> c) booleancontainsAll(IntSet set) Whether this set contains all ints in the given IntSetbooleanvoidvoidforEach(IntConsumer action) Performs the given action for each int of theIntSetuntil all elements have been processed or the action throws an exception.inthashCode()Creates aSpliterator.OfIntover the ints in this set.A stream of ints representing the data in this setbooleanisEmpty()iterator()A primtive iterator that allows iteration over the int values.intnextSetBit(int fromIndex) Returns the next int in the set that is greater than or equal to the given value.booleanremove(int i) Removes, if present, the int from the set and returns if it was present or notbooleanbooleanremoveAll(Collection<?> c) booleanRemoves all ints from this IntSet that are in the provided IntSetbooleanremoveIf(IntPredicate filter) Removes all the ints of this set that satisfy the given predicate.booleanretainAll(Collection<?> c) booleanModifies this set to remove all ints that are not present in the provided IntSetvoidset(int i) Adds or sets the int without returning whether it was previously setintsize()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.int[]Returns an array containing all of the elements in this set.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, toArrayMethods inherited from interface java.util.Set
spliterator
-
Constructor Details
-
RangeSet
@ProtoFactory public RangeSet(int size)
-
-
Method Details
-
size
-
isEmpty
-
contains
-
contains
-
iterator
Description copied from interface:IntSetA primtive iterator that allows iteration over the int values. This iterator supports removal if the set is modifiable. -
toIntArray
public int[] toIntArray()Description copied from interface:IntSetReturns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.- Specified by:
toIntArrayin interfaceIntSet- Returns:
- this int set as an array
-
toBitSet
public byte[] toBitSet()Description copied from interface:IntSetReturns 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.
-
nextSetBit
public int nextSetBit(int fromIndex) Description copied from interface:IntSetReturns the next int in the set that is greater than or equal to the given value.- Specified by:
nextSetBitin interfaceIntSet- Parameters:
fromIndex- : inclusive index to start searching.- Returns:
- the index of the next set bit, or -1 if there is no such bit
-
toArray
-
toArray
-
add
-
remove
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<Integer>- Specified by:
containsAllin interfaceSet<Integer>
-
containsAll
Description copied from interface:IntSetWhether this set contains all ints in the given IntSet- Specified by:
containsAllin interfaceIntSet- Parameters:
set- the set to check if all are present- Returns:
- if the set contains all the ints
-
add
-
set
-
addAll
-
addAll
-
retainAll
-
retainAll
-
removeAll
-
removeAll
-
clear
-
equals
-
intStream
-
forEach
Description copied from interface:IntSetPerforms the given action for each int of theIntSetuntil all elements have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of iteration (if an iteration order is specified). Exceptions thrown by the action are relayed to the caller.The default implementation behaves as if:
PrimitiveIterator.OfInt iterator = iterator(); while (iterator.hasNext()) { action.accept(iterator.nextInt()); } -
forEach
-
intSpliterator
Description copied from interface:IntSetCreates aSpliterator.OfIntover the ints in this set.The
Spliterator.OfIntreportsSpliterator.DISTINCT. Implementations should document the reporting of additional characteristic values. The default implementation creates a late-binding spliterator from the set'sIterator. The spliterator inherits the fail-fast properties of the set's iterator.The created
Spliterator.OfIntadditionally reportsSpliterator.SIZED. The createdSpliterator.OfIntadditionally reportsSpliterator.SUBSIZED.- Specified by:
intSpliteratorin interfaceIntSet- Returns:
- a
Spliterator.OfIntover the ints in this set
-
removeIf
Description copied from interface:IntSetRemoves 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 anUnsupportedOperationExceptionwill be thrown on the first matching element. -
hashCode
-
toString
-