Mega Code Archive

 
Categories / Java Book / 005 Collection
 

0283 Get the index of an element

int indexOf(Object o) Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. int lastIndexOf(Object o) Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.