|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.util.IntSet
A set of integers. Optimized to have an extremely compact representation when the set is "dense", i.e., has many sequential elements. For example {1, 2} and {1, 2, ..., 1000} require the same amount of space. All retrieval operations run in O(log n) time, where n is the size of the set. Insertion operations may be slower.
All methods have the same specification as the Set class, except that values are restricted to int' for the reason described above. For this reason, methods are not specified below. Like Set, this class is not synchronized.
Nested Class Summary | |
class |
IntSet.IntSetIterator
Yields a sequence of int's (not Object's) in order, without removal support. |
Field Summary | |
java.util.ArrayList |
list
Our current implementation consists of a list of disjoint intervals, sorted by starting location. |
Constructor Summary | |
IntSet()
|
|
IntSet(int expectedSize)
|
Method Summary | |
boolean |
add(int x)
|
boolean |
addAll(IntSet s)
|
boolean |
contains(int x)
|
IntSet.IntSetIterator |
iterator()
Returns the values of this in order from lowest to highest, as int. |
boolean |
remove(int x)
|
protected void |
repOk()
Checks rep invariant. |
boolean |
retainAll(IntSet s)
|
int |
size()
|
java.lang.String |
toString()
|
void |
trim()
Ensures that this consumes the minimum amount of memory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public java.util.ArrayList list
Constructor Detail |
public IntSet()
public IntSet(int expectedSize)
Method Detail |
protected void repOk()
public int size()
public boolean contains(int x)
public boolean add(int x)
public boolean remove(int x)
public boolean addAll(IntSet s)
public boolean retainAll(IntSet s)
public void trim()
public IntSet.IntSetIterator iterator()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |