jsat.utils
Class IntSetFixedSize
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<java.lang.Integer>
-
- jsat.utils.IntSetFixedSize
-
- 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 IntSetFixedSize extends java.util.AbstractSet<java.lang.Integer> implements java.io.SerializableA set for integers that is of a fixed initial size, and can only accept integers in the range [0, size). Insertions, removals, and checks are all constant time with a fast iterator.
Null values are not supported- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description IntSetFixedSize(int size)Creates a new fixed size int set
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanadd(int e)Adds a new integer into the setbooleanadd(java.lang.Integer e)booleancontains(int val)Checks if the given value is contained in this setbooleancontains(java.lang.Object o)java.util.Iterator<java.lang.Integer>iterator()booleanremove(int val)Removes the specified integer from the setbooleanremove(java.lang.Object o)intsize()-
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, retainAll, toArray, toArray, toString
-
-
-
-
Constructor Detail
-
IntSetFixedSize
public IntSetFixedSize(int size)
Creates a new fixed size int set- Parameters:
size- the size of the int set
-
-
Method Detail
-
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>
-
add
public boolean add(int e)
Adds a new integer into the set- Parameters:
e- the value to add into the set- Returns:
trueif the operation modified the set,falseotherwise.
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<java.lang.Integer>- Specified by:
removein interfacejava.util.Set<java.lang.Integer>- Overrides:
removein classjava.util.AbstractCollection<java.lang.Integer>
-
remove
public boolean remove(int val)
Removes the specified integer from the set- Parameters:
val- the value to remove- Returns:
trueif the set was modified by this operation,falseif it was not.
-
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>
-
contains
public boolean contains(int val)
Checks if the given value is contained in this set- Parameters:
val- the value to check for- Returns:
trueif the value is in the set,falseotherwise.
-
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>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG