| bak.pcj.list.AbstractCharList bak.pcj.list.CharArrayList
All known Subclasses: bak.pcj.list.CharArrayStack,
Field Summary | |
final public static int | DEFAULT_CAPACITY The default capacity of this list. | final public static int | DEFAULT_GROWTH_CHUNK The default chunk size with which to increase the capacity of this list. | final public static double | DEFAULT_GROWTH_FACTOR The default factor with which to increase the capacity of this list. |
Constructor Summary | |
public | CharArrayList() Creates a new array list with capacity 10 and a relative
growth factor of 1.0. | public | CharArrayList(CharCollection c) Creates a new array list with the same elements as a
specified collection. | public | CharArrayList(char[] a) Creates a new array list with the same elements as a
specified array. | public | CharArrayList(int capacity) Creates a new array list with a specified capacity and a
relative growth factor of 1.0. | public | CharArrayList(int capacity, double growthFactor) Creates a new array list with a specified capacity and
relative growth factor. | public | CharArrayList(int capacity, int growthChunk) Creates a new array list with a specified capacity and
absolute growth factor.
The array capacity increases to capacity()+growthChunk.
This strategy is good for avoiding wasting memory. |
Method Summary | |
public void | add(int index, char v) | public int | capacity() Returns the current capacity of this list. | public void | clear() | public Object | clone() Returns a clone of this array list. | public boolean | contains(char v) | public int | ensureCapacity(int capacity) Ensures that this list has at least a specified capacity.
The actual capacity is calculated from the growth factor
or growth chunk specified to the constructor.
Parameters: capacity - the minimum capacity of this list. | public boolean | equals(Object obj) | public char | get(int index) | public int | hashCode() | public int | indexOf(char c) | public int | indexOf(int index, char c) | public boolean | isEmpty() | public int | lastIndexOf(char c) | public boolean | remove(char v) | public char | removeElementAt(int index) | public char | set(int index, char v) | public int | size() | public char[] | toArray() | public char[] | toArray(char[] a) | public void | trimToSize() Minimizes the memory used by this array list. |
DEFAULT_CAPACITY | final public static int DEFAULT_CAPACITY(Code) | | The default capacity of this list.
|
DEFAULT_GROWTH_CHUNK | final public static int DEFAULT_GROWTH_CHUNK(Code) | | The default chunk size with which to increase the capacity of this list.
|
DEFAULT_GROWTH_FACTOR | final public static double DEFAULT_GROWTH_FACTOR(Code) | | The default factor with which to increase the capacity of this list.
|
CharArrayList | public CharArrayList(CharCollection c)(Code) | | Creates a new array list with the same elements as a
specified collection. The elements of the specified collection
are added to the end of the list in the collection's iteration
order.
Parameters: c - the collection whose elements to add to the newlist. throws: NullPointerException - if c is null. |
CharArrayList | public CharArrayList(char[] a)(Code) | | Creates a new array list with the same elements as a
specified array. The elements of the specified array
are added to the end of the list in order of the array.
Parameters: a - the array whose elements to add to the newlist. throws: NullPointerException - if a is null. since: 1.1 |
CharArrayList | public CharArrayList(int capacity, double growthFactor)(Code) | | Creates a new array list with a specified capacity and
relative growth factor.
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.
Parameters: capacity - the initial capacity of the list. Parameters: growthFactor - the relative amount with which to increase thethe capacity when a capacity increase is needed. throws: IllegalArgumentException - if capacity is negative;if growthFactor is negative. |
CharArrayList | public CharArrayList(int capacity, int growthChunk)(Code) | | Creates a new array list with a specified capacity and
absolute growth factor.
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.
Parameters: capacity - the initial capacity of the list. Parameters: growthChunk - the absolute amount with which to increase thethe capacity when a capacity increase is needed. throws: IllegalArgumentException - if capacity is negative;if growthChunk is negative. |
add | public void add(int index, char v)(Code) | | |
capacity | public int capacity()(Code) | | Returns the current capacity of this list. The capacity is the
number of elements that the list can contain without having to
increase the amount of memory used.
the current capacity of this list. See Also: CharArrayList.ensureCapacity(int) |
clear | public void clear()(Code) | | |
clone | public Object clone()(Code) | | Returns a clone of this array list.
a clone of this array list. since: 1.1 |
contains | public boolean contains(char v)(Code) | | |
ensureCapacity | public int ensureCapacity(int capacity)(Code) | | Ensures that this list has at least a specified capacity.
The actual capacity is calculated from the growth factor
or growth chunk specified to the constructor.
Parameters: capacity - the minimum capacity of this list. the new capacity of this list. See Also: CharArrayList.capacity() |
get | public char get(int index)(Code) | | |
hashCode | public int hashCode()(Code) | | |
indexOf | public int indexOf(char c)(Code) | | |
indexOf | public int indexOf(int index, char c)(Code) | | since: 1.2 |
isEmpty | public boolean isEmpty()(Code) | | |
lastIndexOf | public int lastIndexOf(char c)(Code) | | |
remove | public boolean remove(char v)(Code) | | |
removeElementAt | public char removeElementAt(int index)(Code) | | |
set | public char set(int index, char v)(Code) | | |
toArray | public char[] toArray()(Code) | | |
toArray | public char[] toArray(char[] a)(Code) | | |
trimToSize | public void trimToSize()(Code) | | Minimizes the memory used by this array list. The underlying
array is replaced by an array whose size is exactly the number
of elements in this array list. The method can be used to
free up memory after many removals.
|
|
|