public class IntArrayList extends Object
int
values.Constructor and Description |
---|
IntArrayList()
Constructs an empty list.
|
IntArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity
|
Modifier and Type | Method and Description |
---|---|
void |
add(int value)
Adds a value to the end of this list.
|
void |
addAll(int[] values)
Adds all values in an array to the end of this list.
|
void |
ensureCapacity(int capacity)
Increases the capacity of this list instance, if necessary,
to ensure that it can hold at least the number of elements
specified by the capacity argument.
|
int |
size()
Returns the number of values in this list.
|
int[] |
toArray()
Returns a int array containing a copy of
the values in this list.
|
public IntArrayList()
public IntArrayList(int initialCapacity)
initialCapacity
- the initial capacity of the listpublic int size()
public void ensureCapacity(int capacity)
capacity
- the desired capacitypublic void add(int value)
value
- the value to addpublic void addAll(int[] values)
values
- an array of valuespublic int[] toArray()
Copyright © 2024. All rights reserved.