Top Description Fields Constructors Methods
io.netty5.util.internal

public final Class RecyclableArrayList

extends ArrayList<Object>
Class Inheritance
Imports
io.netty5.util.internal.ObjectPool.Handle, java.util.ArrayList, .Collection, .List, .RandomAccess

A simple list which is recyclable. This implementation does not allow null elements to be added.

Field Summary

Modifier and TypeField and Description
private static final int
private final ObjectPool.Handle<RecyclableArrayList>
private boolean
private static final ObjectPool<RecyclableArrayList>
private static final long

Constructor Summary

AccessConstructor and Description
private
private

Method Summary

Modifier and TypeMethod and Description
public boolean
add(Object
element to be appended to this list
element
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Appends the specified element to the end of this list.
public void
add(int
index at which the specified element is to be inserted
index
,
Object
element to be inserted
element
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Inserts the specified element at the specified position in this list.
public boolean
addAll(Collection<?>
collection containing elements to be added to this list
c
)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.
public boolean
addAll(int
index at which to insert the first element from the specified collection
index
,
Collection<?>
collection containing elements to be added to this list
c
)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position.
private static void
public boolean
insertSinceRecycled()

Returns true if any elements where added or set.

public static RecyclableArrayList
newInstance()

Create a new empty RecyclableArrayList instance

public static RecyclableArrayList
newInstance(int minCapacity)

Create a new empty RecyclableArrayList instance with the given capacity.

public boolean
recycle()

Clear and recycle this instance.

public Object
set(int
index of the element to replace
index
,
Object
element to be stored at the specified position
element
)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element.
Inherited from java.util.ArrayList:
addFirstaddLastclearclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveremoveremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsizesortspliteratorsubListtoArraytoArraytrimToSize

Field Detail

DEFAULT_INITIAL_CAPACITYback to summary
private static final int DEFAULT_INITIAL_CAPACITY
handleback to summary
private final ObjectPool.Handle<RecyclableArrayList> handle
insertSinceRecycledback to summary
private boolean insertSinceRecycled
RECYCLERback to summary
private static final ObjectPool<RecyclableArrayList> RECYCLER
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.util.ArrayList.serialVersionUID.

Constructor Detail

RecyclableArrayListback to summary
private RecyclableArrayList(ObjectPool.Handle<RecyclableArrayList> handle)
RecyclableArrayListback to summary
private RecyclableArrayList(ObjectPool.Handle<RecyclableArrayList> handle, int initialCapacity)

Method Detail

addback to summary
public boolean add(Object element)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Doc from java.util.ArrayList.add.

Appends the specified element to the end of this list.

Parameters
element:Object

element to be appended to this list

Returns:boolean

true (as specified by Collection#add)

Annotations
@Override
addback to summary
public void add(int index, Object element)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Doc from java.util.ArrayList.add.

Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters
index:int

index at which the specified element is to be inserted

element:Object

element to be inserted

Annotations
@Override
addAllback to summary
public boolean addAll(Collection<?> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Doc from java.util.ArrayList.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)

Parameters
c:Collection<?>

collection containing elements to be added to this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
addAllback to summary
public boolean addAll(int index, Collection<?> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Doc from java.util.ArrayList.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.

Parameters
index:int

index at which to insert the first element from the specified collection

c:Collection<?>

collection containing elements to be added to this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
checkNullElementsback to summary
private static void checkNullElements(Collection<?> c)
insertSinceRecycledback to summary
public boolean insertSinceRecycled()

Returns true if any elements where added or set. This will be reset once recycle() was called.

newInstanceback to summary
public static RecyclableArrayList newInstance()

Create a new empty RecyclableArrayList instance

newInstanceback to summary
public static RecyclableArrayList newInstance(int minCapacity)

Create a new empty RecyclableArrayList instance with the given capacity.

recycleback to summary
public boolean recycle()

Clear and recycle this instance.

setback to summary
public Object set(int index, Object element)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Doc from java.util.ArrayList.set.

Replaces the element at the specified position in this list with the specified element.

Parameters
index:int

index of the element to replace

element:Object

element to be stored at the specified position

Returns:Object

the element previously at the specified position

Annotations
@Override