|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bak.pcj.AbstractCharCollection bak.pcj.list.AbstractCharList bak.pcj.list.CharArrayList
This class represents an array implemenation of lists of char values.
ArrayList
,
Serialized FormField Summary | |
static int |
DEFAULT_CAPACITY
The default capacity of this list. |
static int |
DEFAULT_GROWTH_CHUNK
The default chunk size with which to increase the capacity of this list. |
static double |
DEFAULT_GROWTH_FACTOR
The default factor with which to increase the capacity of this list. |
Constructor Summary | |
CharArrayList()
Creates a new array list with capacity 10 and a relative growth factor of 1.0. |
|
CharArrayList(char[] a)
Creates a new array list with the same elements as a specified array. |
|
CharArrayList(CharCollection c)
Creates a new array list with the same elements as a specified collection. |
|
CharArrayList(int capacity)
Creates a new array list with a specified capacity and a relative growth factor of 1.0. |
|
CharArrayList(int capacity,
double growthFactor)
Creates a new array list with a specified capacity and relative growth factor. |
|
CharArrayList(int capacity,
int growthChunk)
Creates a new array list with a specified capacity and absolute growth factor. |
Method Summary | |
void |
add(int index,
char v)
Throws UnsupportedOperationException. |
int |
capacity()
Returns the current capacity of this list. |
void |
clear()
Clears this collection. |
Object |
clone()
Returns a clone of this array list. |
boolean |
contains(char v)
Indicates whether this collection contains a specified element. |
int |
ensureCapacity(int capacity)
Ensures that this list has at least a specified capacity. |
boolean |
equals(Object obj)
Indicates whether this collection is equal to some object. |
char |
get(int index)
Returns the element at a specified position in this list. |
int |
hashCode()
Returns a hash code value for this collection. |
int |
indexOf(char c)
Returns the index of the first occurance of a specified element in this list. |
int |
indexOf(int index,
char c)
Returns the index of the first occurance of a specified element in this list after or at a specified index. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
int |
lastIndexOf(char c)
Returns the index of the last occurance of a specified element in this list. |
boolean |
remove(char v)
Removes a specified element from this collection. |
char |
removeElementAt(int index)
Throws UnsupportedOperationException. |
char |
set(int index,
char v)
Sets a specified element to a new value. |
int |
size()
Returns the number of elements in this collection. |
char[] |
toArray()
Returns the elements of this collection as an array. |
char[] |
toArray(char[] a)
Returns the elements of this collection as an array. |
void |
trimToSize()
Minimizes the memory used by this array list. |
Methods inherited from class bak.pcj.list.AbstractCharList |
add, addAll, iterator, lastIndexOf, listIterator, listIterator |
Methods inherited from class bak.pcj.AbstractCharCollection |
addAll, containsAll, removeAll, retainAll, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface bak.pcj.CharCollection |
addAll, containsAll, removeAll, retainAll |
Field Detail |
public static final double DEFAULT_GROWTH_FACTOR
public static final int DEFAULT_GROWTH_CHUNK
public static final int DEFAULT_CAPACITY
Constructor Detail |
public CharArrayList()
CharArrayList(int,double)
public CharArrayList(CharCollection c)
c
- the collection whose elements to add to the new
list.
NullPointerException
- if c is null.public CharArrayList(char[] a)
a
- the array whose elements to add to the new
list.
NullPointerException
- if a is null.public CharArrayList(int capacity)
capacity
- the initial capacity of the list.
IllegalArgumentException
- if capacity is negative.CharArrayList(int,double)
public CharArrayList(int capacity, double growthFactor)
The array capacity increases to capacity()*(1+growthFactor). This strategy is good for avoiding many capacity increases, but the amount of wasted memory is approximately the size of the list.
capacity
- the initial capacity of the list.growthFactor
- the relative amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if growthFactor is negative.public CharArrayList(int capacity, int growthChunk)
The array capacity increases to capacity()+growthChunk. This strategy is good for avoiding wasting memory. However, an overhead is potentially introduced by frequent capacity increases.
capacity
- the initial capacity of the list.growthChunk
- the absolute amount with which to increase the
the capacity when a capacity increase is needed.
IllegalArgumentException
- if capacity is negative;
if growthChunk is negative.Method Detail |
public int ensureCapacity(int capacity)
capacity
- the minimum capacity of this list.
capacity()
public int capacity()
ensureCapacity(int)
public void add(int index, char v)
AbstractCharList
add
in interface CharList
add
in class AbstractCharList
public char get(int index)
CharList
get
in interface CharList
index
- the position of the element to return.
public char set(int index, char v)
CharList
set
in interface CharList
index
- the index of the element whose value to set.v
- the new value of the specified element.
public char removeElementAt(int index)
AbstractCharList
removeElementAt
in interface CharList
removeElementAt
in class AbstractCharList
public void trimToSize()
trimToSize
in interface CharCollection
trimToSize
in class AbstractCharCollection
public Object clone()
public int size()
CharCollection
size
in interface CharCollection
size
in class AbstractCharCollection
public boolean isEmpty()
CharCollection
isEmpty
in interface CharCollection
isEmpty
in class AbstractCharCollection
public void clear()
CharCollection
clear
in interface CharCollection
clear
in class AbstractCharCollection
public boolean contains(char v)
CharCollection
contains
in interface CharCollection
contains
in class AbstractCharCollection
public int indexOf(char c)
CharList
indexOf
in interface CharList
indexOf
in class AbstractCharList
public int indexOf(int index, char c)
CharList
indexOf
in interface CharList
indexOf
in class AbstractCharList
public int lastIndexOf(char c)
CharList
lastIndexOf
in interface CharList
lastIndexOf
in class AbstractCharList
public boolean remove(char v)
CharCollection
remove
in interface CharCollection
remove
in class AbstractCharCollection
public char[] toArray()
CharCollection
toArray
in interface CharCollection
toArray
in class AbstractCharCollection
public char[] toArray(char[] a)
CharCollection
toArray
in interface CharCollection
toArray
in class AbstractCharCollection
public boolean equals(Object obj)
CharCollection
equals
in interface CharCollection
equals
in class AbstractCharList
public int hashCode()
CharCollection
hashCode
in interface CharCollection
hashCode
in class AbstractCharList
|
PCJ API Version 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |