| |
|
| bak.pcj.list.AbstractShortList bak.pcj.list.ShortArrayDeque
Field Summary | |
final public static int | DEFAULT_CAPACITY The default capacity of this deque. | final public static int | DEFAULT_GROWTH_CHUNK The default chunk size with which to increase the capacity of this deque. | final public static double | DEFAULT_GROWTH_FACTOR The default factor with which to increase the capacity of this deque. |
Constructor Summary | |
public | ShortArrayDeque() Creates a new array deque with capacity 10 and a relative
growth factor of 1.0. | public | ShortArrayDeque(ShortCollection c) Creates a new array deque with the same elements as a
specified collection. | public | ShortArrayDeque(short[] a) Creates a new array deque with the same elements as a
specified array. | public | ShortArrayDeque(int capacity) Creates a new array deque with a specified capacity and a
relative growth factor of 1.0. | public | ShortArrayDeque(int capacity, double growthFactor) Creates a new array deque with a specified capacity and
relative growth factor. | public | ShortArrayDeque(int capacity, int growthChunk) Creates a new array deque 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, short v) | public void | addFirst(short v) | public void | addLast(short v) | public int | capacity() Returns the current capacity of this deque. | public void | clear() | public Object | clone() Returns a clone of this array deque. | public boolean | contains(short v) | public int | ensureCapacity(int capacity) Ensures that this deque 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 deque. | public boolean | equals(Object obj) | public short | get(int index) | public short | getFirst() | public short | getLast() | public int | hashCode() | public int | indexOf(short c) | public boolean | isEmpty() | public int | lastIndexOf(short c) | public boolean | remove(short v) | public short | removeElementAt(int index) | public short | removeFirst() | public short | removeLast() | public short | set(int index, short v) | public int | size() | public short[] | toArray(short[] a) | public void | trimToSize() Minimizes the memory used by this array deque. |
DEFAULT_CAPACITY | final public static int DEFAULT_CAPACITY(Code) | | The default capacity of this deque.
|
DEFAULT_GROWTH_CHUNK | final public static int DEFAULT_GROWTH_CHUNK(Code) | | The default chunk size with which to increase the capacity of this deque.
|
DEFAULT_GROWTH_FACTOR | final public static double DEFAULT_GROWTH_FACTOR(Code) | | The default factor with which to increase the capacity of this deque.
|
ShortArrayDeque | public ShortArrayDeque(ShortCollection c)(Code) | | Creates a new array deque with the same elements as a
specified collection. The elements of the specified collection
are added to the end of the deque in the collection's iteration
order.
Parameters: c - the collection whose elements to add to the newdeque. throws: NullPointerException - if c is null. |
ShortArrayDeque | public ShortArrayDeque(short[] a)(Code) | | Creates a new array deque with the same elements as a
specified array. The elements of the specified array
are added the end of the deque in the order in which they
appear in the array.
Parameters: a - the array whose elements to add to the new deque. throws: NullPointerException - if a is null. since: 1.1 |
ShortArrayDeque | public ShortArrayDeque(int capacity, double growthFactor)(Code) | | Creates a new array deque 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 deque.
Parameters: capacity - the initial capacity of the deque. 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. |
ShortArrayDeque | public ShortArrayDeque(int capacity, int growthChunk)(Code) | | Creates a new array deque 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 deque. 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, short v)(Code) | | |
addFirst | public void addFirst(short v)(Code) | | |
addLast | public void addLast(short v)(Code) | | |
capacity | public int capacity()(Code) | | Returns the current capacity of this deque. The capacity is the
number of elements that the deque can contain without having to
increase the amount of memory used.
the current capacity of this deque. See Also: ShortArrayDeque.ensureCapacity(int) |
clear | public void clear()(Code) | | |
clone | public Object clone()(Code) | | Returns a clone of this array deque.
a clone of this array deque. since: 1.1 |
contains | public boolean contains(short v)(Code) | | |
ensureCapacity | public int ensureCapacity(int capacity)(Code) | | Ensures that this deque 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 deque. the new capacity of this deque. See Also: ShortArrayDeque.capacity() |
get | public short get(int index)(Code) | | |
getFirst | public short getFirst()(Code) | | |
getLast | public short getLast()(Code) | | |
hashCode | public int hashCode()(Code) | | |
indexOf | public int indexOf(short c)(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | |
lastIndexOf | public int lastIndexOf(short c)(Code) | | |
remove | public boolean remove(short v)(Code) | | |
removeElementAt | public short removeElementAt(int index)(Code) | | |
removeFirst | public short removeFirst()(Code) | | |
removeLast | public short removeLast()(Code) | | |
set | public short set(int index, short v)(Code) | | |
toArray | public short[] toArray(short[] a)(Code) | | |
trimToSize | public void trimToSize()(Code) | | Minimizes the memory used by this array deque. The underlying
array is replaced by an array whose size is exactly the number
of elements in this array deque. The method can be used to
free up memory after many removals.
|
|
|
|