|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.util.MutabilityControl
com.android.dx.util.IntList
public final class IntList
Simple list of ints.
| Field Summary | |
|---|---|
static IntList |
EMPTY
non-null; immutable, no-element instance |
| Constructor Summary | |
|---|---|
IntList()
Constructs an empty instance with a default initial capacity. |
|
IntList(int initialCapacity)
Constructs an empty instance. |
|
| Method Summary | |
|---|---|
void |
add(int value)
Adds an element to the end of the list. |
int |
binarysearch(int value)
Performs a binary search on a sorted list, returning the index of the given value if it is present or (-(insertion point) - 1) if the value is not present. |
boolean |
contains(int value)
Returns whether or not the given value appears in the list. |
boolean |
equals(Object other)
|
int |
get(int n)
Gets the indicated value. |
int |
hashCode()
|
int |
indexOf(int value)
Returns the index of the given value, or -1 if the value does not appear in the list. |
void |
insert(int n,
int value)
Inserts element into specified index, moving elements at and above that index up one. |
static IntList |
makeImmutable(int value)
Constructs a new immutable instance with the given element. |
static IntList |
makeImmutable(int value0,
int value1)
Constructs a new immutable instance with the given elements. |
IntList |
mutableCopy()
Makes and returns a mutable copy of the list. |
int |
pop()
Pops an element off the end of the list and decreasing the size by one. |
void |
pop(int n)
Pops N elements off the end of the list and decreasing the size by N. |
void |
removeIndex(int n)
Removes an element at a given index, shifting elements at greater indicies down one. |
void |
set(int n,
int value)
Sets the value at the given index. |
void |
shrink(int newSize)
Shrinks the size of the list. |
int |
size()
Gets the number of elements in this list. |
void |
sort()
Sorts the elements in the list in-place. |
int |
top()
Returns the last element in the array without modifying the array |
String |
toString()
|
| Methods inherited from class com.android.dx.util.MutabilityControl |
|---|
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final IntList EMPTY
non-null; immutable, no-element instance
| Constructor Detail |
|---|
public IntList()
public IntList(int initialCapacity)
initialCapacity - >= 0; initial capacity of the list| Method Detail |
|---|
public static IntList makeImmutable(int value)
value - the sole value in the list
public static IntList makeImmutable(int value0,
int value1)
value0 - the first value in the listvalue1 - the second value in the listpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Objectpublic String toString()
toString in class Objectpublic int size()
public int get(int n)
n - >= 0, < size(); which element
public void set(int n,
int value)
n - >= 0, < size(); which elementvalue - value to storepublic void add(int value)
value - the value to add
public void insert(int n,
int value)
n - >= 0, <=size(); index of where to insertvalue - value to insertpublic void removeIndex(int n)
n - >=0, < size(); index of element to removepublic int top()
IndexOutOfBoundsException - if stack is emptypublic int pop()
IndexOutOfBoundsException - if stack is emptypublic void pop(int n)
n - >= 0; number of elements to remove from end
IndexOutOfBoundsException - if stack is smaller than Npublic void shrink(int newSize)
newSize - >= 0; the new sizepublic IntList mutableCopy()
non-null; an appropriately-constructed instancepublic void sort()
public int indexOf(int value)
value - value to find
public int binarysearch(int value)
(-(insertion point) - 1) if the value is not present.
If the list is not sorted, then reverts to linear search and returns
-size() if the element is not found.
value - value to find
(-(insertion point) - 1) if the
value is not presentpublic boolean contains(int value)
value - value to look for
sort()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||