T - the type of elements in this listpublic class SimpleArrayList<T> extends Object implements ISimpleList<T>
ArrayList.| Constructor and Description |
|---|
SimpleArrayList()
Creates a new instance of
SimpleArrayList. |
SimpleArrayList(int initialCapacity)
Creates a new instance of
SimpleArrayList with the specified initial capacity. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T element)
Adds an element to the list at the specified index.
|
void |
add(T element)
Adds an element to the end of the list.
|
T |
get(int index)
Returns the element at the specified index.
|
int |
indexOf(Object element)
Returns the index of the first occurrence of the specified element in the list,
or -1 if the list does not contain the element.
|
boolean |
isEmpty()
Returns
true if the list contains no elements, false otherwise. |
void |
remove(int index)
Removes the element at the specified index.
|
T |
set(int index,
T element)
Replaces the element at the specified index with the specified element.
|
int |
size()
Returns the number of elements in the list.
|
public SimpleArrayList()
SimpleArrayList.public SimpleArrayList(int initialCapacity)
SimpleArrayList with the specified initial capacity.initialCapacity - the initial capacity of the listpublic void add(T element)
add in interface ISimpleList<T>element - the element to addpublic void add(int index,
T element)
add in interface ISimpleList<T>index - the index at which to add the elementelement - the element to addpublic T get(int index)
get in interface ISimpleList<T>index - the index of the element to returnpublic T set(int index, T element)
set in interface ISimpleList<T>index - the index of the element to replaceelement - the element to be stored at the specified indexpublic int indexOf(Object element)
indexOf in interface ISimpleList<T>element - the element to search forpublic void remove(int index)
remove in interface ISimpleList<T>index - the index of the element to be removedpublic int size()
size in interface ISimpleList<T>public boolean isEmpty()
true if the list contains no elements, false otherwise.isEmpty in interface ISimpleList<T>true if the list contains no elements, false otherwiseCopyright © 1998–2025 Apryse Group NV. All rights reserved.