jsat.utils
Class IntSortedSet
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<java.lang.Integer>
-
- jsat.utils.IntSortedSet
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.Set<java.lang.Integer>, java.util.SortedSet<java.lang.Integer>
public class IntSortedSet extends java.util.AbstractSet<java.lang.Integer> implements java.io.Serializable, java.util.SortedSet<java.lang.Integer>A utility class for efficiently storing a set of integers. In order to do this, the integers are stored in their natural order.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description IntSortedSet()IntSortedSet(java.util.Collection<java.lang.Integer> collection)Creates a set of integers from the given collectionIntSortedSet(int initialSize)IntSortedSet(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 booleanadd(java.lang.Integer e)java.util.Comparator<? super java.lang.Integer>comparator()booleancontains(int o)booleancontains(java.lang.Object o)java.lang.Integerfirst()static IntSortedSetfrom(int... ints)Creates a set of integers from the given list of integers.java.util.SortedSet<java.lang.Integer>headSet(java.lang.Integer toElement)java.util.Iterator<java.lang.Integer>iterator()java.lang.Integerlast()intsize()java.util.SortedSet<java.lang.Integer>subSet(java.lang.Integer fromElement, java.lang.Integer toElement)java.util.SortedSet<java.lang.Integer>tailSet(java.lang.Integer fromElement)-
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
IntSortedSet
public IntSortedSet(int initialSize)
-
IntSortedSet
public IntSortedSet(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
-
IntSortedSet
public IntSortedSet(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
-
IntSortedSet
public IntSortedSet()
-
-
Method Detail
-
from
public static IntSortedSet 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
-
add
public boolean add(java.lang.Integer e)
- Specified by:
addin interfacejava.util.Collection<java.lang.Integer>- Specified by:
addin interfacejava.util.Set<java.lang.Integer>- Overrides:
addin classjava.util.AbstractCollection<java.lang.Integer>
-
contains
public boolean contains(int o)
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<java.lang.Integer>- Specified by:
containsin interfacejava.util.Set<java.lang.Integer>- Overrides:
containsin classjava.util.AbstractCollection<java.lang.Integer>
-
iterator
public java.util.Iterator<java.lang.Integer> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Integer>- Specified by:
iteratorin interfacejava.util.Collection<java.lang.Integer>- Specified by:
iteratorin interfacejava.util.Set<java.lang.Integer>- Specified by:
iteratorin classjava.util.AbstractCollection<java.lang.Integer>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<java.lang.Integer>- Specified by:
sizein interfacejava.util.Set<java.lang.Integer>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.Integer>
-
comparator
public java.util.Comparator<? super java.lang.Integer> comparator()
- Specified by:
comparatorin interfacejava.util.SortedSet<java.lang.Integer>
-
subSet
public java.util.SortedSet<java.lang.Integer> subSet(java.lang.Integer fromElement, java.lang.Integer toElement)- Specified by:
subSetin interfacejava.util.SortedSet<java.lang.Integer>
-
headSet
public java.util.SortedSet<java.lang.Integer> headSet(java.lang.Integer toElement)
- Specified by:
headSetin interfacejava.util.SortedSet<java.lang.Integer>
-
tailSet
public java.util.SortedSet<java.lang.Integer> tailSet(java.lang.Integer fromElement)
- Specified by:
tailSetin interfacejava.util.SortedSet<java.lang.Integer>
-
first
public java.lang.Integer first()
- Specified by:
firstin interfacejava.util.SortedSet<java.lang.Integer>
-
last
public java.lang.Integer last()
- Specified by:
lastin interfacejava.util.SortedSet<java.lang.Integer>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG