public class IntSet
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
static class |
IntSet.IntSetIterator |
限定符和类型 | 字段和说明 |
---|---|
int |
size |
构造器和说明 |
---|
IntSet()
Creates a new set with an initial capacity of 51 and a load factor of 0.8.
|
IntSet(int initialCapacity)
Creates a new set with a load factor of 0.8.
|
IntSet(int initialCapacity,
float loadFactor)
Creates a new set with the specified initial capacity and load factor.
|
IntSet(IntSet set)
Creates a new set identical to the specified set.
|
限定符和类型 | 方法和说明 |
---|---|
boolean |
add(int key)
Returns true if the key was not already in the set.
|
void |
addAll(int... array) |
void |
addAll(int[] array,
int offset,
int length) |
void |
addAll(IntArray array) |
void |
addAll(IntArray array,
int offset,
int length) |
void |
addAll(IntSet set) |
void |
clear() |
void |
clear(int maximumCapacity)
Clears the set and reduces the size of the backing arrays to be the specified capacity if they are larger.
|
boolean |
contains(int key) |
void |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
boolean |
equals(java.lang.Object obj) |
int |
first() |
int |
hashCode() |
IntSet.IntSetIterator |
iterator()
Returns an iterator for the keys in the set.
|
boolean |
remove(int key)
Returns true if the key was removed.
|
void |
shrink(int maximumCapacity)
Reduces the size of the backing arrays to be the specified capacity or less.
|
java.lang.String |
toString() |
static IntSet |
with(int... array) |
public IntSet()
public IntSet(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public IntSet(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public IntSet(IntSet set)
public boolean add(int key)
public void addAll(IntArray array)
public void addAll(IntArray array, int offset, int length)
public void addAll(int... array)
public void addAll(int[] array, int offset, int length)
public void addAll(IntSet set)
public boolean remove(int key)
public void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
public boolean contains(int key)
public int first()
public void ensureCapacity(int additionalCapacity)
public int hashCode()
hashCode
在类中 java.lang.Object
public boolean equals(java.lang.Object obj)
equals
在类中 java.lang.Object
public java.lang.String toString()
toString
在类中 java.lang.Object
public IntSet.IntSetIterator iterator()
IntSet.IntSetIterator
constructor for nested or multithreaded iteration.public static IntSet with(int... array)