Java Reference
In-Depth Information
public boolean remove(Object theElement)
Removes the fi rst occurrence of theElement from the calling object. If theElement is
found in the calling object, then each element in the calling object with an index greater than
or equal to theElement 's index is decreased to have an index that is one less than the value
it had previously. Returns true if theElement was found (and removed). Returns false
if theElement was not found in the calling object. If the element was removed, the size is
decreased by one. The capacity is not changed.
protected void removeRange( int fromIndex, int toIndex)
Removes all elements with index greater than or equal to fromIndex and strictly less than
toIndex . Be sure to note that this method is protected , not public .
public void clear()
Removes all elements from the calling object and sets its size to zero.
SEARCH METHODS
public boolean isEmpty()
Returns true if the calling object is empty (that is, has size 0) ; otherwise returns false .
public boolean contains(Object target)
Returns true if target is an element of the calling object; otherwise returns false . Uses the
method equals of the object target to test for equality.
public int indexOf(Object target)
Returns the index of the fi rst element that is equal to target . Uses the method equals of the
object target to test for equality. Returns − 1 if target is not found.
public int lastIndexOf(Object target)
Returns the index of the last element that is equal to target . Uses the method equals of the
object target to test for equality. Returns − 1 if target is not found.
ITERATORS
public Iterator<T> iterator()
Returns an iterator for the calling object. Iterators are discussed in Section 16.3.
public ListIterator<T> listIterator()
Returns a ListIterator<T> for the calling object. ListIterator<T> is discussed in
Section 16.3.
Search WWH ::




Custom Search