I\'m familiar with the ways I can get an element position in array, especially the ones showed here: Element position in array
But my problem is I can\'t figure out
just use the call listPackages.indexOf(current_package);
ArrayList.contains(Object o)
calls indexOf(Object o)
internally in ArrayList:
/**
* Returns true if this list contains the specified element.
* More formally, returns true if and only if this list contains
* at least one element e such that
* (o==null ? e==null : o.equals(e)).
*
* @param o element whose presence in this list is to be tested
* @return true if this list contains the specified element
*/
public boolean contains(Object o) {
return indexOf(o) >= 0;
}