Inbuilt Methods

In this lesson, the mostly used inbuilt methods of ArrayList class are explained.

ArrayLists have plenty of inbuilt methods that can be accessed by the programmers to store and manage data. We will frequently come across method overloading in these inbuilt methods below.

Adding an element

Addition of the elements to ArrayLists can be achieved using add() method:

Method Name Description Return Type
add(object)
The item is added to the end of the current ArrayList
boolean
add(index, object)
Adds a single object of the respective type at the specified index to the ArrayList
void

Note: add(index, object) method pushes the element on the current index to the next index.

Get hands-on with 1200+ tech skills courses.