- add()
public boolean add(E e)
public void add(int index, E element)
Adds an element to the list or inserts it at a specified index.
- addAll()
public boolean addAll(Collection extends E> c)
public boolean addAll(int index, Collection extends E> c)
Adds all elements from a collection to the list, optionally at a given position.
- clear()
public void clear()
Removes all elements from the list, leaving it empty.
- clone()
public Object clone()
Returns a shallow copy of the ArrayList.
- contains()
public boolean contains(Object o)
Checks if the list contains a specific element.
- ensureCapacity()
public void ensureCapacity(int minCapacity)
Increases the capacity of the list to ensure it can hold more elements.
- forEach()
public void forEach(Consumer super E> action)
Applies an action to each element in the list.
- get()
public E get(int index)
Returns the element at the specified index.
- indexOf()
public int indexOf(Object o)
Returns the index of the first occurrence of the specified element.
- isEmpty()
public boolean isEmpty()
Checks if the list has no elements.
- iterator()
public Iterator iterator()
Returns an iterator to traverse the list.
- lastIndexOf()
public int lastIndexOf(Object o)
Returns the index of the last occurrence of the specified element.
- listIterator()
public ListIterator listIterator()
public ListIterator listIterator(int index)
Returns a list iterator for the list or from a specific index.
- remove()
public E remove(int index)
public boolean remove(Object o)
Removes the element at the given index or removes the first occurrence of the specified element.
- removeAll()
public boolean removeAll(Collection> c)
Removes all elements that are also in the specified collection.
- removeIf()
public boolean removeIf(Predicate super E> filter)
Removes all elements that satisfy the given condition.
- removeRange()
protected void removeRange(int fromIndex, int toIndex)
Removes elements between the specified range of indexes.
- replaceAll()
public void replaceAll(UnaryOperator operator)
Replaces each element using the specified operator.
- retainAll()
public boolean retainAll(Collection> c)
Keeps only the elements that are also in the specified collection.
- set()
public E set(int index, E element)
Replaces the element at the given index with a new one.
- size()
public int size()
Returns the number of elements in the list.
- sort()
public void sort(Comparator super E> c)
Sorts the list using the given comparator.
- spliterator()
public Spliterator spliterator()
Creates a Spliterator for the list elements.
- subList()
public List subList(int fromIndex, int toIndex)
Returns a view of the portion of this list between fromIndex and toIndex.
- toArray()
public Object[] toArray()
public T[] toArray(T[] a)
Returns an array containing all elements in this list.
- trimToSize()
public void trimToSize()
Trims the capacity of the list to match its current size.
Comments
Loading comments...