⬅ Previous Topic
Java StringvalueOf()
method⬅ Previous Topic
Java StringvalueOf()
methodpublic boolean add(E e)
public void add(int index, E element)
Adds an element to the list or inserts it at a specified index.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.public void clear()
Removes all elements from the list, leaving it empty.public Object clone()
Returns a shallow copy of the ArrayList.public boolean contains(Object o)
Checks if the list contains a specific element.public void ensureCapacity(int minCapacity)
Increases the capacity of the list to ensure it can hold more elements.public void forEach(Consumer super E> action)
Applies an action to each element in the list.public E get(int index)
Returns the element at the specified index.public int indexOf(Object o)
Returns the index of the first occurrence of the specified element.public boolean isEmpty()
Checks if the list has no elements.public Iterator iterator()
Returns an iterator to traverse the list.public int lastIndexOf(Object o)
Returns the index of the last occurrence of the specified element.public ListIterator listIterator()
public ListIterator listIterator(int index)
Returns a list iterator for the list or from a specific index.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.public boolean removeAll(Collection> c)
Removes all elements that are also in the specified collection.public boolean removeIf(Predicate super E> filter)
Removes all elements that satisfy the given condition.protected void removeRange(int fromIndex, int toIndex)
Removes elements between the specified range of indexes.public void replaceAll(UnaryOperator operator)
Replaces each element using the specified operator.public boolean retainAll(Collection> c)
Keeps only the elements that are also in the specified collection.public E set(int index, E element)
Replaces the element at the given index with a new one.public int size()
Returns the number of elements in the list.public void sort(Comparator super E> c)
Sorts the list using the given comparator.public Spliterator spliterator()
Creates a Spliterator for the list elements.public List subList(int fromIndex, int toIndex)
Returns a view of the portion of this list between fromIndex and toIndex.public Object[] toArray()
public T[] toArray(T[] a)
Returns an array containing all elements in this list.public void trimToSize()
Trims the capacity of the list to match its current size.⬅ Previous Topic
Java StringvalueOf()
methodYou can support this website with a contribution of your choice.
When making a contribution, mention your name, and programguru.org in the message. Your name shall be displayed in the sponsors list.