|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.util.IntSet
public class IntSet
A collection of 32-bit integer primitives that contains no duplicate elements. IntSet provides the minimal operations for working with on a set of integers: add, remove, contains, and clear. Additionally, IntSet provides methods for determining the number of integers in the set, and for retrieving the integers as an array.
IntSet
| Nested Class Summary | |
|---|---|
protected static class |
IntSet.Bucket
|
| Field Summary | |
|---|---|
protected int |
bucketInitialCapacity
|
protected IntSet.Bucket[] |
buckets
|
protected static int |
DEFAULT_BUCKET_CAPACITY
|
protected static int |
DEFAULT_NUM_BUCKETS
|
protected int |
numBuckets
|
protected int |
size
|
| Constructor Summary | |
|---|---|
IntSet()
Creates an empty IntSet with the default number of buckets and initial bucket capacity. |
|
IntSet(int numBuckets,
int bucketInitialCapacity)
Creates an empty IntSet with the specified number of buckets and initial bucket capacity. |
|
| Method Summary | |
|---|---|
boolean |
add(int value)
Adds the specified value to this set. |
void |
clear()
Removes all of the values from this set. |
boolean |
contains(int value)
Indicates whether this set contains the specified value. |
boolean |
remove(int value)
Removes the specified value from this set. |
int |
size()
Returns the number of unique integers in this set. |
int[] |
toArray(int[] array)
Returns the values in this set as a 32-bit integer array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int bucketInitialCapacity
protected IntSet.Bucket[] buckets
protected static final int DEFAULT_BUCKET_CAPACITY
protected static final int DEFAULT_NUM_BUCKETS
protected int numBuckets
protected int size
| Constructor Detail |
|---|
public IntSet()
public IntSet(int numBuckets,
int bucketInitialCapacity)
numBuckets - the number of buckets this IntSet uses tobucketInitialCapacity - the initial capacity for each bucket.
IllegalArgumentException - if either numBuckets or bucketInitialCapacity is less than 1.| Method Detail |
|---|
public boolean add(int value)
value - the value to add.
public void clear()
public boolean contains(int value)
value - the value to test.
public boolean remove(int value)
value - the value to remove.
public int size()
public int[] toArray(int[] array)
null or is not large enough, this allocates and returns a new array
with length equal to this set's size.
array - the array into which the values are stored.
null or not large
enough.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||