The class is non final to allow embedding it directly and thus saving on object allocation.
| Modifier and Type | Field 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. |
| Access | Constructor and Description |
|---|---|
| public | LinkedArrayList(int
the hint used for pre-sizing the internal array capacityHint)Constructor with the capacity hint of each array segment. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public int | Returns: the capacity hint that indicates the capacity of each buffer segmentReturns the capacity hint that indicates the capacity of each buffer segment. |
| public Object[] | |
| public int | Returns: the index of the next slot in the tail buffer segmentReturns the index of the next slot in the tail buffer segment. |
| public int | |
| public Object[] | |
| pack-priv List | |
| public String |
| capacityHint | back to summary |
|---|---|
| pack-priv final int capacityHint The capacity of each array segment. | |
| head | back to summary |
|---|---|
| pack-priv Object[] head Contains the head of the linked array list if not null. The length is always capacityHint + 1 and the last element is an Object[] pointing to the next element of the linked array list. | |
| indexInTail | back to summary |
|---|---|
| pack-priv int indexInTail The next available slot in the current tail. | |
| size | back 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). | |
| tail | back to summary |
|---|---|
| pack-priv Object[] tail The tail array where new elements will be added. | |
| LinkedArrayList | back to summary |
|---|---|
| public LinkedArrayList(int capacityHint) Constructor with the capacity hint of each array segment.
| |
| add | back to summary |
|---|---|
| public void add(Object o) Adds a new element to this list.
| |
| capacityHint | back to summary |
|---|---|
| public int capacityHint() Returns the capacity hint that indicates the capacity of each buffer segment.
| |
| head | back to summary |
|---|---|
| public Object[] head() Returns the head buffer segment or null if the list is empty.
| |
| indexInTail | back to summary |
|---|---|
| public int indexInTail() Returns the index of the next slot in the tail buffer segment.
| |
| size | back to summary |
|---|---|
| public int size() Returns the total size of the list.
| |
| tail | back to summary |
|---|---|
| public Object[] tail() Returns the tail buffer segment or null if the list is empty.
| |
| toList | back to summary |
|---|---|
| pack-priv List | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |