|
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.AbstractLongCollection
bak.pcj.list.AbstractLongList
bak.pcj.list.LongArrayList
This class represents an array implemenation of lists of long 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 | |
LongArrayList()
Creates a new array list with capacity 10 and a relative growth factor of 1.0. |
|
LongArrayList(int capacity)
Creates a new array list with a specified capacity and a relative growth factor of 1.0. |
|
LongArrayList(int capacity,
double growthFactor)
Creates a new array list with a specified capacity and relative growth factor. |
|
LongArrayList(int capacity,
int growthChunk)
Creates a new array list with a specified capacity and absolute growth factor. |
|
LongArrayList(long[] a)
Creates a new array list with the same elements as a specified array. |
|
LongArrayList(LongCollection c)
Creates a new array list with the same elements as a specified collection. |
|
| Method Summary | |
void |
add(int index,
long 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(long 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. |
long |
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(int index,
long c)
Returns the index of the first occurance of a specified element in this list after or at a specified index. |
int |
indexOf(long c)
Returns the index of the first occurance of a specified element in this list. |
boolean |
isEmpty()
Indicates whether this collection is empty. |
int |
lastIndexOf(long c)
Returns the index of the last occurance of a specified element in this list. |
boolean |
remove(long v)
Removes a specified element from this collection. |
long |
removeElementAt(int index)
Throws UnsupportedOperationException. |
long |
set(int index,
long v)
Sets a specified element to a new value. |
int |
size()
Returns the number of elements in this collection. |
long[] |
toArray()
Returns the elements of this collection as an array. |
long[] |
toArray(long[] 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.AbstractLongList |
add, addAll, iterator, lastIndexOf, listIterator, listIterator |
| Methods inherited from class bak.pcj.AbstractLongCollection |
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.LongCollection |
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 LongArrayList()
LongArrayList(int,double)public LongArrayList(LongCollection c)
c - the collection whose elements to add to the new
list.
NullPointerException - if c is null.public LongArrayList(long[] a)
a - the array whose elements to add to the new
list.
NullPointerException - if a is null.public LongArrayList(int capacity)
capacity - the initial capacity of the list.
IllegalArgumentException - if capacity is negative.LongArrayList(int,double)
public LongArrayList(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 LongArrayList(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,
long v)
AbstractLongList
add in interface LongListadd in class AbstractLongListpublic long get(int index)
LongList
get in interface LongListindex - the position of the element to return.
public long set(int index,
long v)
LongList
set in interface LongListindex - the index of the element whose value to set.v - the new value of the specified element.
public long removeElementAt(int index)
AbstractLongList
removeElementAt in interface LongListremoveElementAt in class AbstractLongListpublic void trimToSize()
trimToSize in interface LongCollectiontrimToSize in class AbstractLongCollectionpublic Object clone()
public int size()
LongCollection
size in interface LongCollectionsize in class AbstractLongCollectionpublic boolean isEmpty()
LongCollection
isEmpty in interface LongCollectionisEmpty in class AbstractLongCollectionpublic void clear()
LongCollection
clear in interface LongCollectionclear in class AbstractLongCollectionpublic boolean contains(long v)
LongCollection
contains in interface LongCollectioncontains in class AbstractLongCollectionpublic int indexOf(long c)
LongList
indexOf in interface LongListindexOf in class AbstractLongList
public int indexOf(int index,
long c)
LongList
indexOf in interface LongListindexOf in class AbstractLongListpublic int lastIndexOf(long c)
LongList
lastIndexOf in interface LongListlastIndexOf in class AbstractLongListpublic boolean remove(long v)
LongCollection
remove in interface LongCollectionremove in class AbstractLongCollectionpublic long[] toArray()
LongCollection
toArray in interface LongCollectiontoArray in class AbstractLongCollectionpublic long[] toArray(long[] a)
LongCollection
toArray in interface LongCollectiontoArray in class AbstractLongCollectionpublic boolean equals(Object obj)
LongCollection
equals in interface LongCollectionequals in class AbstractLongListpublic int hashCode()
LongCollection
hashCode in interface LongCollectionhashCode in class AbstractLongList
|
PCJ API Version 1.2 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||