|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<Integer>
com.samskivert.util.ArrayIntSet
public class ArrayIntSet
Provides an IntSet implementation using a sorted array of
integers to maintain the contents of the set.
| Field Summary | |
|---|---|
protected int |
_size
The number of elements in this set. |
protected int[] |
_values
An array containing the values in this set. |
protected static int |
DEFAULT_CAPACITY
The default initial capacity of this set. |
| Constructor Summary | |
|---|---|
ArrayIntSet()
Constructs an empty set with the default initial capacity. |
|
ArrayIntSet(int initialCapacity)
Construct an ArrayIntSet of the specified initial capacity. |
|
ArrayIntSet(int[] values)
Construct an ArrayIntSet with the specified starting values. |
|
| Method Summary | |
|---|---|
boolean |
add(int value)
Adds the specified element to this set if it is not already present (optional operation). |
boolean |
add(int[] values)
Add all of the values in the supplied array to the set. |
boolean |
add(Integer o)
|
boolean |
addAll(Collection<? extends Integer> c)
|
protected int |
binarySearch(int key)
Performs a binary search on our values array, looking for the specified value. |
void |
clear()
|
Object |
clone()
|
boolean |
contains(int value)
Returns true if this set contains the specified element. |
boolean |
contains(Object o)
|
boolean |
containsAll(Collection<?> c)
|
boolean |
equals(Object o)
|
int |
get(int index)
Returns the element at the specified index. |
int |
hashCode()
|
Interator |
interator()
Return an Interator over the ints in this object. |
boolean |
isEmpty()
|
Iterator<Integer> |
iterator()
|
boolean |
remove(int value)
Removes the specified element from this set if it is present (optional operation). |
boolean |
remove(int[] values)
Removes all values in the supplied array from the set. |
boolean |
remove(Object o)
|
boolean |
retainAll(Collection<?> c)
|
int |
size()
|
Object[] |
toArray()
|
Integer[] |
toArray(Integer[] a)
|
int[] |
toIntArray()
Returns an array containing all of the elements in this set. |
int[] |
toIntArray(int[] target,
int offset)
Serializes this int set into an array at the specified offset. |
short[] |
toShortArray()
Creates an array of shorts from the contents of this set. |
String |
toString()
|
| Methods inherited from class java.util.AbstractSet |
|---|
removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
toArray |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
removeAll, toArray |
| Field Detail |
|---|
protected int[] _values
protected int _size
protected static final int DEFAULT_CAPACITY
| Constructor Detail |
|---|
public ArrayIntSet(int[] values)
public ArrayIntSet(int initialCapacity)
public ArrayIntSet()
| Method Detail |
|---|
public int size()
size in interface Collection<Integer>size in interface Set<Integer>size in class AbstractCollection<Integer>public int get(int index)
public boolean isEmpty()
isEmpty in interface Collection<Integer>isEmpty in interface Set<Integer>isEmpty in class AbstractCollection<Integer>public boolean contains(Object o)
contains in interface Collection<Integer>contains in interface Set<Integer>contains in class AbstractCollection<Integer>public boolean contains(int value)
IntSet
contains in interface IntSetvalue - element whose presence in this set is to be tested.
public Interator interator()
Interable
interator in interface Interableinterator in interface IntSetpublic Iterator<Integer> iterator()
iterator in interface Iterable<Integer>iterator in interface Collection<Integer>iterator in interface Set<Integer>iterator in class AbstractCollection<Integer>public Object[] toArray()
toArray in interface Collection<Integer>toArray in interface Set<Integer>toArray in class AbstractCollection<Integer>public Integer[] toArray(Integer[] a)
public int[] toIntArray()
IntSet
toIntArray in interface IntSet
public int[] toIntArray(int[] target,
int offset)
public short[] toShortArray()
public boolean add(Integer o)
add in interface Collection<Integer>add in interface Set<Integer>add in class AbstractCollection<Integer>public boolean add(int value)
IntSet
add in interface IntSetvalue - element to be added to this set.
public boolean add(int[] values)
values - elements to be added to this set.
public boolean remove(Object o)
remove in interface Collection<Integer>remove in interface Set<Integer>remove in class AbstractCollection<Integer>public boolean remove(int value)
IntSet
remove in interface IntSetvalue - element to be removed from this set, if present.
public boolean remove(int[] values)
values - elements to be removed from the set.
public boolean containsAll(Collection<?> c)
containsAll in interface Collection<Integer>containsAll in interface Set<Integer>containsAll in class AbstractCollection<Integer>public boolean addAll(Collection<? extends Integer> c)
addAll in interface Collection<Integer>addAll in interface Set<Integer>addAll in class AbstractCollection<Integer>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<Integer>retainAll in interface Set<Integer>retainAll in class AbstractCollection<Integer>public void clear()
clear in interface Collection<Integer>clear in interface Set<Integer>clear in class AbstractCollection<Integer>public boolean equals(Object o)
equals in interface Collection<Integer>equals in interface Set<Integer>equals in class AbstractSet<Integer>public int hashCode()
hashCode in interface Collection<Integer>hashCode in interface Set<Integer>hashCode in class AbstractSet<Integer>public Object clone()
clone in class Objectpublic String toString()
toString in class AbstractCollection<Integer>protected int binarySearch(int key)
java.util.Arrays because
those wankers didn't provide a means by which to perform a binary
search on a subset of an array.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||