public final class ResizingObjectArray extends Object implements Serializable
Object
array storage.
Unlike ResizingArrayStorage
, the array provided by this class is always of type Object[]
. This
results in a higher efficiency, since there is no need for reflection when creating new arrays.
Modifier and Type | Field and Description |
---|---|
Object[] |
array
The storage array.
|
static int |
DEFAULT_INITIAL_CAPACITY
The arrays default initial capacity.
|
Constructor and Description |
---|
ResizingObjectArray()
Constructor.
|
ResizingObjectArray(int initialCapacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
ensureCapacity(int minCapacity) |
void |
hintNextCapacity(int nextCapacityHint)
Hints the next required capacity.
|
void |
setAll(Object value)
Sets all the elements in the array to the specified value.
|
boolean |
shrink(int maxCapacity) |
void |
swap(ResizingObjectArray other) |
public static final int DEFAULT_INITIAL_CAPACITY
public Object[] array
public ResizingObjectArray()
DEFAULT_INITIAL_CAPACITY
public ResizingObjectArray(int initialCapacity)
initialCapacity
- the initial capacity.public void hintNextCapacity(int nextCapacityHint)
nextCapacityHint
- the next capacity hint.public boolean ensureCapacity(int minCapacity)
public boolean shrink(int maxCapacity)
public void setAll(Object value)
value
- the value.public void swap(ResizingObjectArray other)
Copyright © 2018. All rights reserved.