Class SimpleArrayList
java.lang.Object
com.itextpdf.commons.datastructures.SimpleArrayList
- Type Parameters:
-
T- the type of elements in this list
- All Implemented Interfaces:
-
ISimpleList
Portable implementation of
ArrayList.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofSimpleArrayList.SimpleArrayList(int initialCapacity) Creates a new instance ofSimpleArrayListwith the specified initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an element to the list at the specified index.voidAdds an element to the end of the list.get(int index) Returns the element at the specified index.intReturns the index of the first occurrence of the specified element in the list, or -1 if the list does not contain the element.booleanisEmpty()Returnstrueif the list contains no elements, false otherwise.voidremove(int index) Removes the element at the specified index.Replaces the element at the specified index with the specified element.intsize()Returns the number of elements in the list.
-
Constructor Details
-
SimpleArrayList
public SimpleArrayList()Creates a new instance ofSimpleArrayList. -
SimpleArrayList
public SimpleArrayList(int initialCapacity) Creates a new instance ofSimpleArrayListwith the specified initial capacity.- Parameters:
-
initialCapacity- the initial capacity of the list
-
-
Method Details
-
add
Adds an element to the end of the list.- Specified by:
-
addin interfaceISimpleList<T> - Parameters:
-
element- the element to add
-
add
Adds an element to the list at the specified index.- Specified by:
-
addin interfaceISimpleList<T> - Parameters:
-
index- the index at which to add the element -
element- the element to add
-
get
Returns the element at the specified index.- Specified by:
-
getin interfaceISimpleList<T> - Parameters:
-
index- the index of the element to return - Returns:
- the element at the specified index
-
set
Replaces the element at the specified index with the specified element.- Specified by:
-
setin interfaceISimpleList<T> - Parameters:
-
index- the index of the element to replace -
element- the element to be stored at the specified index - Returns:
- the element previously at the specified index
-
indexOf
Returns the index of the first occurrence of the specified element in the list, or -1 if the list does not contain the element.- Specified by:
-
indexOfin interfaceISimpleList<T> - Parameters:
-
element- the element to search for - Returns:
- the index of the first occurrence of the specified element in the list, or -1 if the list does not contain the element
-
remove
public void remove(int index) Removes the element at the specified index.- Specified by:
-
removein interfaceISimpleList<T> - Parameters:
-
index- the index of the element to be removed
-
size
public int size()Returns the number of elements in the list.- Specified by:
-
sizein interfaceISimpleList<T> - Returns:
- the number of elements in the list
-
isEmpty
public boolean isEmpty()Returnstrueif the list contains no elements, false otherwise.- Specified by:
-
isEmptyin interfaceISimpleList<T> - Returns:
-
trueif the list contains no elements, false otherwise
-