Class SmallIntSet

java.lang.Object
org.infinispan.commons.util.SmallIntSet
All Implemented Interfaces:
Iterable<Integer>, Collection<Integer>, Set<Integer>, IntSet

@Deprecated(forRemoval=true) public class SmallIntSet extends Object implements IntSet
Deprecated, for removal: This API element is subject to removal in a future version.
since 9.3 This class will no longer be public. Please use IntSets methods such as IntSets.mutableEmptySet(), IntSets.mutableCopyFrom(Set)
Represent a set of integers (e.g. segments) as a BitSet. Memory usage depends on the highest element, as in BitSet and unlike in other collections such as HashSet.
Since:
9.0
Author:
Dan Berindei
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    SmallIntSet(int initialRange)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Create a new IntSet and pre-allocate space for elements 0..initialRange-1.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(int i)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add an integer to the set without boxing the parameter.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    addAll(Collection<? extends Integer> c)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Adds all ints from the provided set into this one
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    contains(int i)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Check if the set contains an integer without boxing the parameter.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Whether this set contains all ints in the given IntSet
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    forEach(Consumer<? super Integer> action)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Performs the given action for each int of the IntSet until all elements have been processed or the action throws an exception.
    from(byte[] bytes)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    Either converts the given set to an IntSet if it is one or creates a new IntSet and copies the contents
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a Spliterator.OfInt over the ints in this set.
    Deprecated, for removal: This API element is subject to removal in a future version.
    A stream of ints representing the data in this set
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    A primtive iterator that allows iteration over the int values.
    of(int i1)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    of(int... elements)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    of(int i1, int i2)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    of(int i1, int i2, int i3)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    remove(int i)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Remove an integer from the set without boxing.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Removes all ints from this IntSet that are in the provided IntSet
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Removes all of the ints of this set that satisfy the given predicate.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Modifies this set to remove all ints that are not present in the provided IntSet
    void
    set(int i)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add an integer to the set without boxing the parameter or checking if the integer was already present in the set.
    void
    set(int i, boolean value)
    Deprecated, for removal: This API element is subject to removal in a future version.
    If value is true, add the integer to the set, otherwise remove the integer from the set.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> T[]
    toArray(T[] a)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    byte[]
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns a byte array that has a bit set for each int in this set where each byte represents 8 numbers.
    int[]
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns an array containing all of the elements in this set.
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    static void
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, toArray

    Methods inherited from interface org.infinispan.commons.util.IntSet

    stream

    Methods inherited from interface java.util.Set

    spliterator
  • Constructor Details

    • SmallIntSet

      public SmallIntSet()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • SmallIntSet

      public SmallIntSet(int initialRange)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new IntSet and pre-allocate space for elements 0..initialRange-1.
    • SmallIntSet

      public SmallIntSet(Set<Integer> set)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • of

      public static SmallIntSet of(int i1)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • of

      public static SmallIntSet of(int i1, int i2)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • of

      public static SmallIntSet of(int i1, int i2, int i3)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • of

      public static SmallIntSet of(int... elements)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • of

      public static SmallIntSet of(PrimitiveIterator.OfInt iterator)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • from

      public static SmallIntSet from(byte[] bytes)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • from

      public static SmallIntSet from(Set<Integer> set)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Either converts the given set to an IntSet if it is one or creates a new IntSet and copies the contents
      Parameters:
      set -
      Returns:
    • size

      public int size()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      size in interface Collection<Integer>
      Specified by:
      size in interface Set<Integer>
    • capacity

      public int capacity()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isEmpty

      public boolean isEmpty()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      isEmpty in interface Collection<Integer>
      Specified by:
      isEmpty in interface Set<Integer>
    • contains

      public boolean contains(Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      contains in interface Collection<Integer>
      Specified by:
      contains in interface Set<Integer>
    • contains

      public boolean contains(Integer o)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • contains

      public boolean contains(int i)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Check if the set contains an integer without boxing the parameter.
      Specified by:
      contains in interface IntSet
      Parameters:
      i - the int to check
      Returns:
      if the set contains the int
    • iterator

      public PrimitiveIterator.OfInt iterator()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      A primtive iterator that allows iteration over the int values. This iterator supports removal if the set is modifiable.
      Specified by:
      iterator in interface Collection<Integer>
      Specified by:
      iterator in interface IntSet
      Specified by:
      iterator in interface Iterable<Integer>
      Specified by:
      iterator in interface Set<Integer>
      Returns:
      the iterator
    • toIntArray

      public int[] toIntArray()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Returns 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:
      toIntArray in interface IntSet
      Returns:
      this int set as an array
    • toBitSet

      public byte[] toBitSet()
      Deprecated, for removal: This API element is subject to removal in a future version.
      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.

      Specified by:
      toBitSet in interface IntSet
      Returns:
      a byte array containing a little-endian representation of all the ints of this int set as bits
    • toArray

      public Object[] toArray()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      toArray in interface Collection<Integer>
      Specified by:
      toArray in interface Set<Integer>
    • toArray

      public <T> T[] toArray(T[] a)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      toArray in interface Collection<Integer>
      Specified by:
      toArray in interface Set<Integer>
    • add

      public boolean add(Integer i)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      add in interface Collection<Integer>
      Specified by:
      add in interface Set<Integer>
    • add

      public boolean add(int i)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add an integer to the set without boxing the parameter.
      Specified by:
      add in interface IntSet
      Parameters:
      i - the int value to add
      Returns:
      whether this int was already present
    • set

      public void set(int i)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Add an integer to the set without boxing the parameter or checking if the integer was already present in the set.
      Specified by:
      set in interface IntSet
      Parameters:
      i - the value to make sure is in the set
    • set

      public void set(int i, boolean value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      If value is true, add the integer to the set, otherwise remove the integer from the set.
    • remove

      public boolean remove(Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      remove in interface Collection<Integer>
      Specified by:
      remove in interface Set<Integer>
    • remove

      public boolean remove(int i)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Remove an integer from the set without boxing.
      Specified by:
      remove in interface IntSet
      Parameters:
      i - the int to remove
      Returns:
      whether the int was present in the set before it was removed
    • containsAll

      public boolean containsAll(Collection<?> c)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      containsAll in interface Collection<Integer>
      Specified by:
      containsAll in interface Set<Integer>
    • containsAll

      public boolean containsAll(IntSet set)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Whether this set contains all ints in the given IntSet
      Specified by:
      containsAll in interface IntSet
      Parameters:
      set - the set to check if all are present
      Returns:
      if the set contains all the ints
    • addAll

      public boolean addAll(IntSet set)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Adds all ints from the provided set into this one
      Specified by:
      addAll in interface IntSet
      Parameters:
      set - the set of ints to add
      Returns:
      if this set has a new int in it
    • addAll

      public boolean addAll(Collection<? extends Integer> c)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      addAll in interface Collection<Integer>
      Specified by:
      addAll in interface Set<Integer>
    • removeAll

      public boolean removeAll(IntSet set)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Removes all ints from this IntSet that are in the provided IntSet
      Specified by:
      removeAll in interface IntSet
      Parameters:
      set - the ints to remove from this IntSet
      Returns:
      if this set removed any ints
    • removeAll

      public boolean removeAll(Collection<?> c)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      removeAll in interface Collection<Integer>
      Specified by:
      removeAll in interface Set<Integer>
    • retainAll

      public boolean retainAll(Collection<?> c)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      retainAll in interface Collection<Integer>
      Specified by:
      retainAll in interface Set<Integer>
    • retainAll

      public boolean retainAll(IntSet c)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Modifies this set to remove all ints that are not present in the provided IntSet
      Specified by:
      retainAll in interface IntSet
      Parameters:
      c - the ints this set should kep
      Returns:
      if this set removed any ints
    • clear

      public void clear()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      clear in interface Collection<Integer>
      Specified by:
      clear in interface Set<Integer>
    • intStream

      public IntStream intStream()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      A stream of ints representing the data in this set
      Specified by:
      intStream in interface IntSet
      Returns:
      the stream
    • forEach

      public void forEach(IntConsumer action)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Performs the given action for each int of the IntSet until 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.
      Specified by:
      forEach in interface IntSet
      Parameters:
      action - The action to be performed for each element
    • forEach

      public void forEach(Consumer<? super Integer> action)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      forEach in interface Iterable<Integer>
    • intSpliterator

      public Spliterator.OfInt intSpliterator()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Creates a Spliterator.OfInt over the ints in this set.

      The Spliterator.OfInt reports Spliterator.DISTINCT. Implementations should document the reporting of additional characteristic values.

      Specified by:
      intSpliterator in interface IntSet
      Returns:
      a Spliterator.OfInt over the ints in this set
    • removeIf

      public boolean removeIf(IntPredicate filter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: IntSet
      Removes all of 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.
      Specified by:
      removeIf in interface IntSet
      Parameters:
      filter - a predicate which returns true for ints to be removed
      Returns:
      true if any ints were removed
    • equals

      public boolean equals(Object o)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      equals in interface Collection<Integer>
      Specified by:
      equals in interface Set<Integer>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      hashCode in interface Collection<Integer>
      Specified by:
      hashCode in interface Set<Integer>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Overrides:
      toString in class Object
    • writeTo

      public static void writeTo(ObjectOutput output, SmallIntSet set) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      IOException
    • readFrom

      public static SmallIntSet readFrom(ObjectInput input) throws IOException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      IOException