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

public Class LinkedArrayList

extends Object
Class Inheritance
Imports
java.util.*

A list implementation which combines an ArrayList with a LinkedList to avoid copying values when the capacity needs to be increased.

The class is non final to allow embedding it directly and thus saving on object allocation.

Field Summary

Modifier and TypeField and Description
pack-priv final int
capacityHint

The capacity of each array segment.

pack-priv Object[]
head

Contains the head of the linked array list if not null.

pack-priv int
indexInTail

The next available slot in the current tail.

pack-priv volatile int
size

The total size of the list; written after elements have been added (release) and and when read, the value indicates how many elements can be safely read (acquire).

pack-priv Object[]
tail

The tail array where new elements will be added.

Constructor Summary

AccessConstructor and Description
public
LinkedArrayList(int
the expected number of elements to hold (can grow beyond that)
capacityHint
)

Constructor with the capacity hint of each array segment.

Method Summary

Modifier and TypeMethod and Description
public void
add(Object
the object to add, nulls are accepted
o
)

Adds a new element to this list.

public Object[]

Returns:

the head object array
head
()

Returns the head buffer segment or null if the list is empty.

public int

Returns:

the total size of the list
size
()

Returns the total size of the list.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

capacityHintback to summary
pack-priv final int capacityHint

The capacity of each array segment.

indexInTailback to summary
pack-priv int indexInTail

The next available slot in the current tail.

sizeback to summary
pack-priv volatile int size

The total size of the list; written after elements have been added (release) and and when read, the value indicates how many elements can be safely read (acquire).

tailback to summary
pack-priv Object[] tail

The tail array where new elements will be added.

Constructor Detail

LinkedArrayListback to summary
public LinkedArrayList(int capacityHint)

Constructor with the capacity hint of each array segment.

Parameters
capacityHint:int

the expected number of elements to hold (can grow beyond that)

Method Detail

addback to summary
public void add(Object o)

Adds a new element to this list.

Parameters
o:Object

the object to add, nulls are accepted

headback to summary
public Object[] head()

Returns the head buffer segment or null if the list is empty.

Returns:Object[]

the head object array

sizeback to summary
public int size()

Returns the total size of the list.

Returns:int

the total size of the list

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override