public final class ResizingIntArray extends Object
Modifier and Type | Field and Description |
---|---|
int[] |
array
The storage array.
|
static int |
DEFAULT_INITIAL_CAPACITY
The arrays default initial capacity.
|
Constructor and Description |
---|
ResizingIntArray()
Constructor.
|
ResizingIntArray(int initialCapacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
ensureCapacity(int minCapacity) |
void |
hintNextCapacity(int nextCapacityHint)
Hints the next required capacity.
|
void |
setAll(int value)
Sets all the elements in the array to the specified value.
|
boolean |
shrink(int maxCapacity) |
void |
swap(ResizingIntArray other) |
public static final int DEFAULT_INITIAL_CAPACITY
public int[] array
public ResizingIntArray()
DEFAULT_INITIAL_CAPACITY
public ResizingIntArray(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(int value)
value
- the value.public void swap(ResizingIntArray other)
Copyright © 2015. All Rights Reserved.