Documentation of 'jsat.utils.IntSet' Java class
IntSet
jsat.utils

Class IntSet

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.Set<java.lang.Integer>


    public class IntSet
    extends java.util.AbstractSet<java.lang.Integer>
    implements java.io.Serializable
    A utility class for efficiently storing a set of integers. The implementation is based on Algorithm D (Open addressing with double hashing) from Knuth's TAOCP page 528.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      IntSet()
      Creates a new empty integer set
      IntSet(java.util.Collection<java.lang.Integer> collection)
      Creates a set of integers from the given collection
      IntSet(int capacity)
      Creates an empty integer set pre-allocated to store a specific number of items
      IntSet(int capacity, float loadFactor)
      Creates an empty integer set pre-allocated to store a specific number of items
      IntSet(java.util.Set<java.lang.Integer> set)
      Creates a new set of integers from the given set
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean add(int e) 
      boolean add(java.lang.Integer e) 
      void clear() 
      boolean contains(int o) 
      boolean contains(java.lang.Object o) 
      static IntSet from(int... ints)
      Creates a set of integers from the given list of integers.
      java.util.Iterator<java.lang.Integer> iterator() 
      boolean remove(int key) 
      boolean remove(java.lang.Object key) 
      int size() 
      • Methods inherited from class java.util.AbstractSet

        equals, hashCode, removeAll
      • Methods inherited from class java.util.AbstractCollection

        addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Set

        addAll, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • IntSet

        public IntSet()
        Creates a new empty integer set
      • IntSet

        public IntSet(int capacity)
        Creates an empty integer set pre-allocated to store a specific number of items
        Parameters:
        capacity - the number of items to store
      • IntSet

        public IntSet(int capacity,
                      float loadFactor)
        Creates an empty integer set pre-allocated to store a specific number of items
        Parameters:
        capacity - the number of items to store
        loadFactor - the maximum ratio of used to un-used storage
      • IntSet

        public IntSet(java.util.Set<java.lang.Integer> set)
        Creates a new set of integers from the given set
        Parameters:
        set - the set of integers to create a copy of
      • IntSet

        public IntSet(java.util.Collection<java.lang.Integer> collection)
        Creates a set of integers from the given collection
        Parameters:
        collection - a collection of integers to create a set from
    • Method Detail

      • from

        public static IntSet from(int... ints)
        Creates a set of integers from the given list of integers.
        Parameters:
        ints - a list of integers to create a set from
        Returns:
        a set of integers of all the unique integers in the given list
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<java.lang.Integer>
        Specified by:
        clear in interface java.util.Set<java.lang.Integer>
        Overrides:
        clear in class java.util.AbstractCollection<java.lang.Integer>
      • add

        public boolean add(java.lang.Integer e)
        Specified by:
        add in interface java.util.Collection<java.lang.Integer>
        Specified by:
        add in interface java.util.Set<java.lang.Integer>
        Overrides:
        add in class java.util.AbstractCollection<java.lang.Integer>
      • add

        public boolean add(int e)
        Parameters:
        e - element to be added to this set
        Returns:
        true if this set did not already contain the specified element
      • contains

        public boolean contains(int o)
      • remove

        public boolean remove(java.lang.Object key)
        Specified by:
        remove in interface java.util.Collection<java.lang.Integer>
        Specified by:
        remove in interface java.util.Set<java.lang.Integer>
        Overrides:
        remove in class java.util.AbstractCollection<java.lang.Integer>
      • remove

        public boolean remove(int key)
        Parameters:
        key - the value from the set to remove
        Returns:
        true if this set contained the specified element
      • contains

        public boolean contains(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<java.lang.Integer>
        Specified by:
        contains in interface java.util.Set<java.lang.Integer>
        Overrides:
        contains in class java.util.AbstractCollection<java.lang.Integer>
      • iterator

        public java.util.Iterator<java.lang.Integer> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Integer>
        Specified by:
        iterator in interface java.util.Collection<java.lang.Integer>
        Specified by:
        iterator in interface java.util.Set<java.lang.Integer>
        Specified by:
        iterator in class java.util.AbstractCollection<java.lang.Integer>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.lang.Integer>
        Specified by:
        size in interface java.util.Set<java.lang.Integer>
        Specified by:
        size in class java.util.AbstractCollection<java.lang.Integer>

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.