|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbak.pcj.AbstractByteCollection
bak.pcj.list.AbstractByteList
bak.pcj.list.ByteArrayList
This class represents an array implemenation of lists of byte values.
ArrayList,
Serialized Form| Field 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 | |
ByteArrayList()
Creates a new array list with capacity 10 and a relative growth factor of 1.0. |
|
ByteArrayList(byte[] a)
Creates a new array list with the same elements as a specified array. |
|
ByteArrayList(ByteCollection c)
Creates a new array list with the same elements as a specified collection. |
|
ByteArrayList(int capacity)
Creates a new array list with a specified capacity and a relative growth factor of 1.0. |
|
ByteArrayList(int capacity,
double growthFactor)
Creates a new array list with a specified capacity and relative growth factor. |
|
ByteArrayList(int capacity,
int growthChunk)
Creates a new array list with a specified capacity and absolute growth factor. |
|
| Method Summary | |
void |
add(int index,
byte 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(byte 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. |
byte |
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(byte c)
Returns the index of the first occurance of a specified element in this list. |
int |
indexOf(int index,
byte 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(byte c)
Returns the index of the last occurance of a specified element in this list. |
boolean |
remove(byte v)
Removes a specified element from this collection. |
byte |
removeElementAt(int index)
Throws UnsupportedOperationException. |
byte |
set(int index,
byte v)
Sets a specified element to a new value. |
int |
size()
Returns the number of elements in this collection. |
byte[] |
toArray()
Returns the elements of this collection as an array. |
byte[] |
toArray(byte[] 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.AbstractByteList |
add, addAll, iterator, lastIndexOf, listIterator, listIterator |
| Methods inherited from class bak.pcj.AbstractByteCollection |
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.ByteCollection |
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 ByteArrayList()
ByteArrayList(int,double)public ByteArrayList(ByteCollection c)
c - the collection whose elements to add to the new
list.
NullPointerException - if c is null.public ByteArrayList(byte[] a)
a - the array whose elements to add to the new
list.
NullPointerException - if a is null.public ByteArrayList(int capacity)
capacity - the initial capacity of the list.
IllegalArgumentException - if capacity is negative.ByteArrayList(int,double)
public ByteArrayList(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 ByteArrayList(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,
byte v)
AbstractByteList
add in interface ByteListadd in class AbstractByteListpublic byte get(int index)
ByteList
get in interface ByteListindex - the position of the element to return.
public byte set(int index,
byte v)
ByteList
set in interface ByteListindex - the index of the element whose value to set.v - the new value of the specified element.
public byte removeElementAt(int index)
AbstractByteList
removeElementAt in interface ByteListremoveElementAt in class AbstractByteListpublic void trimToSize()
trimToSize in interface ByteCollectiontrimToSize in class AbstractByteCollectionpublic Object clone()
public int size()
ByteCollection
size in interface ByteCollectionsize in class AbstractByteCollectionpublic boolean isEmpty()
ByteCollection
isEmpty in interface ByteCollectionisEmpty in class AbstractByteCollectionpublic void clear()
ByteCollection
clear in interface ByteCollectionclear in class AbstractByteCollectionpublic boolean contains(byte v)
ByteCollection
contains in interface ByteCollectioncontains in class AbstractByteCollectionpublic int indexOf(byte c)
ByteList
indexOf in interface ByteListindexOf in class AbstractByteList
public int indexOf(int index,
byte c)
ByteList
indexOf in interface ByteListindexOf in class AbstractByteListpublic int lastIndexOf(byte c)
ByteList
lastIndexOf in interface ByteListlastIndexOf in class AbstractByteListpublic boolean remove(byte v)
ByteCollection
remove in interface ByteCollectionremove in class AbstractByteCollectionpublic byte[] toArray()
ByteCollection
toArray in interface ByteCollectiontoArray in class AbstractByteCollectionpublic byte[] toArray(byte[] a)
ByteCollection
toArray in interface ByteCollectiontoArray in class AbstractByteCollectionpublic boolean equals(Object obj)
ByteCollection
equals in interface ByteCollectionequals in class AbstractByteListpublic int hashCode()
ByteCollection
hashCode in interface ByteCollectionhashCode in class AbstractByteList
|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||