Table of Contents [hide]
ArrayList‘s indexOf method is used to find out first index of object in arraylist.
indexOf method takes object as argument and returns first occurrence of specified element.
Methods:
public int indexOf(Object o)
returns index of first occurrence of element in the ArrayList.
returns index of first occurrence of element in the ArrayList.
indexOf method return -1 if object is not present in the ArrayList
ArrayList indexOf Example:
Was this post helpful?
Let us know if this post was helpful. Feedbacks are monitored on daily basis. Please do provide feedback as that\'s the only way to improve.