public class FastArray
extends Object
implements Cloneable, Serializable
Resizable object array optimized for append-heavy internal use and lightweight list views.
| Modifiers | Name | Description |
|---|---|---|
static FastArray |
EMPTY_LIST |
Shared empty instance with zero capacity. |
int |
size |
Number of populated elements in the backing array. |
| Constructor and description |
|---|
FastArray(int initialCapacity)Creates an empty array with the specified initial capacity. |
FastArray()Creates an empty array with the default initial capacity. |
FastArray(Collection c)Creates an array containing the elements of the supplied collection. |
FastArray(Object[] objects)Creates an array backed by the supplied object array. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
add(Object o)Appends an element to the end of this array, growing the backing storage when needed. |
|
public void |
addAll(FastArray newData)Appends the populated contents of another FastArray. |
|
public void |
addAll(Object[] newData, int size)Appends the first size elements from the supplied array. |
|
public void |
addAll(List coll)Appends the contents of the supplied list. |
|
public void |
clear()Removes all populated elements while preserving the current capacity. |
|
public FastArray |
clone()Returns a shallow copy with duplicated backing storage. |
|
public FastArray |
copy()Returns a copy containing the populated elements of this array. |
|
public Object |
get(int index)Returns the element at the specified index. |
|
public Object[] |
getArray()Returns the backing storage array. |
|
public boolean |
isEmpty()Indicates whether this array contains any populated elements. |
|
public void |
remove(int index)Removes the element at the specified index and compacts the populated range. |
|
public void |
set(int index, Object o)Replaces the element stored at the specified index. |
|
public int |
size()Returns the number of populated elements. |
|
public List |
toList()Returns a list view of the populated elements. |
|
public String |
toString()Returns a list-style string containing the populated elements. |
Shared empty instance with zero capacity.
Number of populated elements in the backing array.
Creates an empty array with the specified initial capacity.
initialCapacity - the initial storage sizeCreates an empty array with the default initial capacity.
Creates an array containing the elements of the supplied collection.
c - the values to copyCreates an array backed by the supplied object array.
objects - the backing storage containing the initial elementsAppends an element to the end of this array, growing the backing storage when needed.
o - the element to append Appends the populated contents of another FastArray.
newData - the source array to append Appends the first size elements from the supplied array.
newData - the source storagesize - the number of elements to appendAppends the contents of the supplied list.
coll - the values to appendRemoves all populated elements while preserving the current capacity.
Returns a shallow copy with duplicated backing storage.
FastArrayReturns a copy containing the populated elements of this array.
FastArray with copied storageReturns the element at the specified index.
index - the populated index to readReturns the backing storage array.
Indicates whether this array contains any populated elements.
true if no elements are storedRemoves the element at the specified index and compacts the populated range.
index - the populated index to removeReplaces the element stored at the specified index.
index - the populated index to updateo - the replacement elementReturns the number of populated elements.
Returns a list view of the populated elements.
Returns a list-style string containing the populated elements.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.