Modifier and Type | Field and Description |
---|---|
protected int |
modCount
The number of times this list has been structurally modified.
|
Constructor and Description |
---|
IntArrayList()
Constructs an empty list with an initial capacity of ten.
|
IntArrayList(Collection c)
Constructs a list containing the elements of the specified collection,
in the order they are given in the array.
|
IntArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity .
|
IntArrayList(int[] a)
Constructs a list containing the elements of the specified array,
in the order they are given in the array.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(int value)
Appends the specified element to the end of this list.
|
void |
add(int index,
int value)
Inserts the specified element at the specified position in this list.
|
boolean |
addAll(Collection c)
Appends all of the elements in the specified collection, in the order that
they appear in the array.
|
boolean |
addAll(int[] a)
Appends all of the elements in the specified array, in the order that
they appear in the array.
|
boolean |
addAll(int index,
Collection c)
Inserts all of the elements in the specified array into this list,
starting at the specified position.
|
boolean |
addAll(int index,
int[] a)
Inserts all of the elements in the specified array into this list,
starting at the specified position.
|
void |
clear()
Removes all of the elements from this list.
|
Object |
clone()
Returns a copy of this IntArrayList instance.
|
boolean |
contains(int value)
Returns true if this list contains the specified element.
|
void |
ensureCapacity(int minCapacity)
Increases the capacity of this IntArrayList instance, if necessary, to
ensure that it can hold at least the number of elements specified by
the minimum capacity argument.
|
boolean |
equals(Object o)
Compares the specified object with this list for equality.
|
int |
get(int index)
Returns the element at the specified position in this list.
|
int |
hashCode()
Returns the hash code value for this list.
|
int |
indexOf(int value)
Searches for the first occurence of the given argument, testing for
equality using the equals method.
|
boolean |
isEmpty()
Tests if this list has no elements.
|
Iterator |
iterator()
Returns an iterator of the elements in this list (in proper sequence).
|
int |
lastIndexOf(int value)
Returns the index of the last occurrence of the specified value
in this list.
|
ListIterator |
listIterator()
Returns an iterator over the elements in this list in proper sequence.
|
ListIterator |
listIterator(int index)
Returns a list iterator of the elements in this list (in proper
sequence), starting at the specified position in the list.
|
int |
peek()
Returns the entry at highest index (stack's top) without removing it.
|
int |
pop()
Removes the entry at highest index (stack's top) returns it.
|
int |
push(int value)
Pushes an entry onto the the end of this list (on top of the stack)
and returns it.
|
int |
remove(int index)
Removes the element at the specified position in this list.
|
protected void |
removeRange(int fromIndex,
int toIndex)
Removes from this List all of the elements whose index is between
fromIndex, inclusive and toIndex, exclusive.
|
int |
search(int value)
Returns the 1-based position where an object is on this stack.
|
int |
set(int index,
int value)
Replaces the element at the specified position in this list with the
specified element.
|
int |
size()
Returns the number of elements in this list.
|
IntArrayList |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between fromIndex,
inclusive, and toIndex, exclusive.
|
int[] |
toArray()
Returns an array containing all of the elements in this list in the
correct order.
|
int[] |
toArray(int[] a)
Returns an array containing all of the elements in this list in
the correct order, using the specified array if it is non-null
and large enough.
|
void |
trimToSize()
Trims the capacity of this ArrayList instance to be the list's
current size.
|
protected transient int modCount
This field is used by the iterators to check for modifications
triggering a ConcurrentModificationException
.
public IntArrayList(int initialCapacity)
public IntArrayList()
public IntArrayList(Collection c)
ClassCastException
- if the collection contains objects of other
class than Integer
NullPointerException
- if the collection contains a null objectpublic IntArrayList(int[] a)
public void add(int index, int value)
IndexOutOfBoundsException
- if index out of range (index
< 0 || index > size())
.public boolean add(int value)
true
(as per the general contract of Collection.add).public boolean addAll(int[] a)
true
if the operation changed this list.public boolean addAll(Collection c)
true
if the operation changed this list.ClassCastException
- if the collection contains objects of other
class than Integer
NullPointerException
- if the collection contains a null objectpublic boolean addAll(int index, Collection c)
index
- index at which to insert first element from the array.c
- Collections of Integers with int values to be inserted into
this list.true
if the operation changed this list.IndexOutOfBoundsException
- if index out of range (index
ClassCastException
- if the collection contains objects of other
class than Integer
NullPointerException
- if the collection contains a null object
< 0 || index > size()).public boolean addAll(int index, int[] a)
index
- index at which to insert first element from the array.a
- elements to be inserted into this list.true
if the operation changed this list.IndexOutOfBoundsException
- if index out of range (index
< 0 || index > size())
.public void clear()
public Object clone()
public boolean contains(int value)
public void ensureCapacity(int minCapacity)
public boolean equals(Object o)
public int get(int index)
public ListIterator listIterator()
int
s retuned by the iterator are wrapped into
Integer
objects.public Iterator iterator()
int
s retuned by the iterator are wrapped into
Integer
objects.public ListIterator listIterator(int index)
int
s retuned by the iterator are wrapped into
Integer
objects.public int hashCode()
public int indexOf(int value)
-1
if the value is not found.public boolean isEmpty()
public int lastIndexOf(int value)
-1
if the value is not found.public int remove(int index)
IndexOutOfBoundsException
- if index out of range (index
< 0 || index ≥ size())
.protected void removeRange(int fromIndex, int toIndex)
A call with toIndex <= fromIndex
has no effect.
IndexOutOfBoundsException
- if an index out of range.public int set(int index, int value)
IndexOutOfBoundsException
- if index out of range (index
< 0 || index > size())
.public int size()
public IntArrayList subList(int fromIndex, int toIndex)
IndexOutOfBoundsException
- if an index out of range.public int[] toArray()
public int[] toArray(int[] a)
public void trimToSize()
public int peek()
EmptyStackException
- if this list/stack is empty.public int pop()
EmptyStackException
- if this list/stack is empty.public int push(int value)
add(value)
.public int search(int value)
-1
indicates that the value is not on the stack.Copyright © 2015–2021 Fiji. All rights reserved.