Java ArrayList Methods | Programiz D11 Phase 2 Skip to main content

Java ArrayList Methods

Java has a lot of ArrayList methods that allow us to work with arraylists. In this reference page, you will find all the arraylist methods available in Java. For example, if you need to add an element to the arraylist, use the add() method.

inserts the element to the arraylist

adds all elements of a collection to arraylist

removes all the elements from arraylist

makes a copy of the array list

checks if the element is present in the arraylist

returns the element present in the specified index

returns the position of the specified element

removes multiple elements from the arraylist

removes the single element from the arraylist

returns the length of an arraylist

checks if the arraylist is empty

returns a portion of the arraylist

replace the single element from an arraylist

sorts the arraylist according to specified order

converts an arraylist to an array

converts the arraylist into a String

set the size of an araylist

returns position of last occurrence of the element

retains only the common elements

checks if a collection is a subset of arraylist

trims the capacity of arraylist equal to the size

removes a portion of the arraylist

replace all elements from the arraylist

removes element that satisfy the condition

performs an action to all elements of arraylist

returns an iterate to loop through the ArrayList