Privacy Policy Terms Of Use. Copyright © 2006-2010 Java Tutorials and Examples.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Java ArrayList provides following methods to search a particular element within the ArrayList.
1) int indexOf(Object element)
Search for a particular element in the ArrayList and return the position of the first occurrence of the element if found within the list, otherwise returns -1.
2) intLastIndexOf(Object element)
Search for a particular element in the ArrayList and return the position of the last occurrence of the element if found within the list, otherwise returns -1.
3) int size()
Returns the number of elements contained in the list.
4) boolean isEmpty()
Returns true of the list is empty, otherwise returns false.
5) boolean contains(Object element)
Returns true if the specified element is found in the list, otherwise returns false.
<< Add Elements to Java ArrayList Remove, Replace, Search Elements from Java ArrayList >>

Post new comment