jaroslav@557: /* jaroslav@557: * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. jaroslav@557: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@557: * jaroslav@557: * This code is free software; you can redistribute it and/or modify it jaroslav@557: * under the terms of the GNU General Public License version 2 only, as jaroslav@557: * published by the Free Software Foundation. Oracle designates this jaroslav@557: * particular file as subject to the "Classpath" exception as provided jaroslav@557: * by Oracle in the LICENSE file that accompanied this code. jaroslav@557: * jaroslav@557: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@557: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@557: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@557: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@557: * accompanied this code). jaroslav@557: * jaroslav@557: * You should have received a copy of the GNU General Public License version jaroslav@557: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@557: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@557: * jaroslav@557: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@557: * or visit www.oracle.com if you need additional information or have any jaroslav@557: * questions. jaroslav@557: */ jaroslav@557: jaroslav@557: package java.util; jaroslav@557: jaroslav@557: /** jaroslav@557: * An ordered collection (also known as a sequence). The user of this jaroslav@557: * interface has precise control over where in the list each element is jaroslav@557: * inserted. The user can access elements by their integer index (position in jaroslav@557: * the list), and search for elements in the list.
jaroslav@557: * jaroslav@557: * Unlike sets, lists typically allow duplicate elements. More formally, jaroslav@557: * lists typically allow pairs of elements e1 and e2 jaroslav@557: * such that e1.equals(e2), and they typically allow multiple jaroslav@557: * null elements if they allow null elements at all. It is not inconceivable jaroslav@557: * that someone might wish to implement a list that prohibits duplicates, by jaroslav@557: * throwing runtime exceptions when the user attempts to insert them, but we jaroslav@557: * expect this usage to be rare.
jaroslav@557: * jaroslav@557: * The List interface places additional stipulations, beyond those jaroslav@557: * specified in the Collection interface, on the contracts of the jaroslav@557: * iterator, add, remove, equals, and jaroslav@557: * hashCode methods. Declarations for other inherited methods are jaroslav@557: * also included here for convenience.
jaroslav@557: * jaroslav@557: * The List interface provides four methods for positional (indexed) jaroslav@557: * access to list elements. Lists (like Java arrays) are zero based. Note jaroslav@557: * that these operations may execute in time proportional to the index value jaroslav@557: * for some implementations (the LinkedList class, for jaroslav@557: * example). Thus, iterating over the elements in a list is typically jaroslav@557: * preferable to indexing through it if the caller does not know the jaroslav@557: * implementation.
jaroslav@557: * jaroslav@557: * The List interface provides a special iterator, called a jaroslav@557: * ListIterator, that allows element insertion and replacement, and jaroslav@557: * bidirectional access in addition to the normal operations that the jaroslav@557: * Iterator interface provides. A method is provided to obtain a jaroslav@557: * list iterator that starts at a specified position in the list.
jaroslav@557: * jaroslav@557: * The List interface provides two methods to search for a specified jaroslav@557: * object. From a performance standpoint, these methods should be used with jaroslav@557: * caution. In many implementations they will perform costly linear jaroslav@557: * searches.
jaroslav@557: * jaroslav@557: * The List interface provides two methods to efficiently insert and jaroslav@557: * remove multiple elements at an arbitrary point in the list.
jaroslav@557: * jaroslav@557: * Note: While it is permissible for lists to contain themselves as elements, jaroslav@557: * extreme caution is advised: the equals and hashCode jaroslav@557: * methods are no longer well defined on such a list. jaroslav@557: * jaroslav@557: *
Some list implementations have restrictions on the elements that jaroslav@557: * they may contain. For example, some implementations prohibit null elements, jaroslav@557: * and some have restrictions on the types of their elements. Attempting to jaroslav@557: * add an ineligible element throws an unchecked exception, typically jaroslav@557: * NullPointerException or ClassCastException. Attempting jaroslav@557: * to query the presence of an ineligible element may throw an exception, jaroslav@557: * or it may simply return false; some implementations will exhibit the former jaroslav@557: * behavior and some will exhibit the latter. More generally, attempting an jaroslav@557: * operation on an ineligible element whose completion would not result in jaroslav@557: * the insertion of an ineligible element into the list may throw an jaroslav@557: * exception or it may succeed, at the option of the implementation. jaroslav@557: * Such exceptions are marked as "optional" in the specification for this jaroslav@557: * interface. jaroslav@557: * jaroslav@557: *
This interface is a member of the
jaroslav@557: *
jaroslav@557: * Java Collections Framework.
jaroslav@557: *
jaroslav@557: * @param The returned array will be "safe" in that no references to it are
jaroslav@557: * maintained by this list. (In other words, this method must
jaroslav@557: * allocate a new array even if this list is backed by an array).
jaroslav@557: * The caller is thus free to modify the returned array.
jaroslav@557: *
jaroslav@557: * This method acts as bridge between array-based and collection-based
jaroslav@557: * APIs.
jaroslav@557: *
jaroslav@557: * @return an array containing all of the elements in this list in proper
jaroslav@557: * sequence
jaroslav@557: * @see Arrays#asList(Object[])
jaroslav@557: */
jaroslav@557: Object[] toArray();
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Returns an array containing all of the elements in this list in
jaroslav@557: * proper sequence (from first to last element); the runtime type of
jaroslav@557: * the returned array is that of the specified array. If the list fits
jaroslav@557: * in the specified array, it is returned therein. Otherwise, a new
jaroslav@557: * array is allocated with the runtime type of the specified array and
jaroslav@557: * the size of this list.
jaroslav@557: *
jaroslav@557: * If the list fits in the specified array with room to spare (i.e.,
jaroslav@557: * the array has more elements than the list), the element in the array
jaroslav@557: * immediately following the end of the list is set to null.
jaroslav@557: * (This is useful in determining the length of the list only if
jaroslav@557: * the caller knows that the list does not contain any null elements.)
jaroslav@557: *
jaroslav@557: * Like the {@link #toArray()} method, this method acts as bridge between
jaroslav@557: * array-based and collection-based APIs. Further, this method allows
jaroslav@557: * precise control over the runtime type of the output array, and may,
jaroslav@557: * under certain circumstances, be used to save allocation costs.
jaroslav@557: *
jaroslav@557: * Suppose x is a list known to contain only strings.
jaroslav@557: * The following code can be used to dump the list into a newly
jaroslav@557: * allocated array of String:
jaroslav@557: *
jaroslav@557: * Lists that support this operation may place limitations on what
jaroslav@557: * elements may be added to this list. In particular, some
jaroslav@557: * lists will refuse to add null elements, and others will impose
jaroslav@557: * restrictions on the type of elements that may be added. List
jaroslav@557: * classes should clearly specify in their documentation any restrictions
jaroslav@557: * on what elements may be added.
jaroslav@557: *
jaroslav@557: * @param e element to be appended to this list
jaroslav@557: * @return true (as specified by {@link Collection#add})
jaroslav@557: * @throws UnsupportedOperationException if the add operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws ClassCastException if the class of the specified element
jaroslav@557: * prevents it from being added to this list
jaroslav@557: * @throws NullPointerException if the specified element is null and this
jaroslav@557: * list does not permit null elements
jaroslav@557: * @throws IllegalArgumentException if some property of this element
jaroslav@557: * prevents it from being added to this list
jaroslav@557: */
jaroslav@557: boolean add(E e);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Removes the first occurrence of the specified element from this list,
jaroslav@557: * if it is present (optional operation). If this list does not contain
jaroslav@557: * the element, it is unchanged. More formally, removes the element with
jaroslav@557: * the lowest index i such that
jaroslav@557: * (o==null ? get(i)==null : o.equals(get(i)))
jaroslav@557: * (if such an element exists). Returns true if this list
jaroslav@557: * contained the specified element (or equivalently, if this list changed
jaroslav@557: * as a result of the call).
jaroslav@557: *
jaroslav@557: * @param o element to be removed from this list, if present
jaroslav@557: * @return true if this list contained the specified element
jaroslav@557: * @throws ClassCastException if the type of the specified element
jaroslav@557: * is incompatible with this list
jaroslav@557: * (optional)
jaroslav@557: * @throws NullPointerException if the specified element is null and this
jaroslav@557: * list does not permit null elements
jaroslav@557: * (optional)
jaroslav@557: * @throws UnsupportedOperationException if the remove operation
jaroslav@557: * is not supported by this list
jaroslav@557: */
jaroslav@557: boolean remove(Object o);
jaroslav@557:
jaroslav@557:
jaroslav@557: // Bulk Modification Operations
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Returns true if this list contains all of the elements of the
jaroslav@557: * specified collection.
jaroslav@557: *
jaroslav@557: * @param c collection to be checked for containment in this list
jaroslav@557: * @return true if this list contains all of the elements of the
jaroslav@557: * specified collection
jaroslav@557: * @throws ClassCastException if the types of one or more elements
jaroslav@557: * in the specified collection are incompatible with this
jaroslav@557: * list
jaroslav@557: * (optional)
jaroslav@557: * @throws NullPointerException if the specified collection contains one
jaroslav@557: * or more null elements and this list does not permit null
jaroslav@557: * elements
jaroslav@557: * (optional),
jaroslav@557: * or if the specified collection is null
jaroslav@557: * @see #contains(Object)
jaroslav@557: */
jaroslav@557: boolean containsAll(Collection> c);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Appends all of the elements in the specified collection to the end of
jaroslav@557: * this list, in the order that they are returned by the specified
jaroslav@557: * collection's iterator (optional operation). The behavior of this
jaroslav@557: * operation is undefined if the specified collection is modified while
jaroslav@557: * the operation is in progress. (Note that this will occur if the
jaroslav@557: * specified collection is this list, and it's nonempty.)
jaroslav@557: *
jaroslav@557: * @param c collection containing elements to be added to this list
jaroslav@557: * @return true if this list changed as a result of the call
jaroslav@557: * @throws UnsupportedOperationException if the addAll operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws ClassCastException if the class of an element of the specified
jaroslav@557: * collection prevents it from being added to this list
jaroslav@557: * @throws NullPointerException if the specified collection contains one
jaroslav@557: * or more null elements and this list does not permit null
jaroslav@557: * elements, or if the specified collection is null
jaroslav@557: * @throws IllegalArgumentException if some property of an element of the
jaroslav@557: * specified collection prevents it from being added to this list
jaroslav@557: * @see #add(Object)
jaroslav@557: */
jaroslav@557: boolean addAll(Collection extends E> c);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Inserts all of the elements in the specified collection into this
jaroslav@557: * list at the specified position (optional operation). Shifts the
jaroslav@557: * element currently at that position (if any) and any subsequent
jaroslav@557: * elements to the right (increases their indices). The new elements
jaroslav@557: * will appear in this list in the order that they are returned by the
jaroslav@557: * specified collection's iterator. The behavior of this operation is
jaroslav@557: * undefined if the specified collection is modified while the
jaroslav@557: * operation is in progress. (Note that this will occur if the specified
jaroslav@557: * collection is this list, and it's nonempty.)
jaroslav@557: *
jaroslav@557: * @param index index at which to insert the first element from the
jaroslav@557: * specified collection
jaroslav@557: * @param c collection containing elements to be added to this list
jaroslav@557: * @return true if this list changed as a result of the call
jaroslav@557: * @throws UnsupportedOperationException if the addAll operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws ClassCastException if the class of an element of the specified
jaroslav@557: * collection prevents it from being added to this list
jaroslav@557: * @throws NullPointerException if the specified collection contains one
jaroslav@557: * or more null elements and this list does not permit null
jaroslav@557: * elements, or if the specified collection is null
jaroslav@557: * @throws IllegalArgumentException if some property of an element of the
jaroslav@557: * specified collection prevents it from being added to this list
jaroslav@557: * @throws IndexOutOfBoundsException if the index is out of range
jaroslav@557: * (index < 0 || index > size())
jaroslav@557: */
jaroslav@557: boolean addAll(int index, Collection extends E> c);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Removes from this list all of its elements that are contained in the
jaroslav@557: * specified collection (optional operation).
jaroslav@557: *
jaroslav@557: * @param c collection containing elements to be removed from this list
jaroslav@557: * @return true if this list changed as a result of the call
jaroslav@557: * @throws UnsupportedOperationException if the removeAll operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws ClassCastException if the class of an element of this list
jaroslav@557: * is incompatible with the specified collection
jaroslav@557: * (optional)
jaroslav@557: * @throws NullPointerException if this list contains a null element and the
jaroslav@557: * specified collection does not permit null elements
jaroslav@557: * (optional),
jaroslav@557: * or if the specified collection is null
jaroslav@557: * @see #remove(Object)
jaroslav@557: * @see #contains(Object)
jaroslav@557: */
jaroslav@557: boolean removeAll(Collection> c);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Retains only the elements in this list that are contained in the
jaroslav@557: * specified collection (optional operation). In other words, removes
jaroslav@557: * from this list all of its elements that are not contained in the
jaroslav@557: * specified collection.
jaroslav@557: *
jaroslav@557: * @param c collection containing elements to be retained in this list
jaroslav@557: * @return true if this list changed as a result of the call
jaroslav@557: * @throws UnsupportedOperationException if the retainAll operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws ClassCastException if the class of an element of this list
jaroslav@557: * is incompatible with the specified collection
jaroslav@557: * (optional)
jaroslav@557: * @throws NullPointerException if this list contains a null element and the
jaroslav@557: * specified collection does not permit null elements
jaroslav@557: * (optional),
jaroslav@557: * or if the specified collection is null
jaroslav@557: * @see #remove(Object)
jaroslav@557: * @see #contains(Object)
jaroslav@557: */
jaroslav@557: boolean retainAll(Collection> c);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Removes all of the elements from this list (optional operation).
jaroslav@557: * The list will be empty after this call returns.
jaroslav@557: *
jaroslav@557: * @throws UnsupportedOperationException if the clear operation
jaroslav@557: * is not supported by this list
jaroslav@557: */
jaroslav@557: void clear();
jaroslav@557:
jaroslav@557:
jaroslav@557: // Comparison and hashing
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Compares the specified object with this list for equality. Returns
jaroslav@557: * true if and only if the specified object is also a list, both
jaroslav@557: * lists have the same size, and all corresponding pairs of elements in
jaroslav@557: * the two lists are equal. (Two elements e1 and
jaroslav@557: * e2 are equal if (e1==null ? e2==null :
jaroslav@557: * e1.equals(e2)).) In other words, two lists are defined to be
jaroslav@557: * equal if they contain the same elements in the same order. This
jaroslav@557: * definition ensures that the equals method works properly across
jaroslav@557: * different implementations of the List interface.
jaroslav@557: *
jaroslav@557: * @param o the object to be compared for equality with this list
jaroslav@557: * @return true if the specified object is equal to this list
jaroslav@557: */
jaroslav@557: boolean equals(Object o);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Returns the hash code value for this list. The hash code of a list
jaroslav@557: * is defined to be the result of the following calculation:
jaroslav@557: *
jaroslav@557: *
jaroslav@557: * This method eliminates the need for explicit range operations (of
jaroslav@557: * the sort that commonly exist for arrays). Any operation that expects
jaroslav@557: * a list can be used as a range operation by passing a subList view
jaroslav@557: * instead of a whole list. For example, the following idiom
jaroslav@557: * removes a range of elements from a list:
jaroslav@557: *
jaroslav@557: *
jaroslav@557: * The semantics of the list returned by this method become undefined if
jaroslav@557: * the backing list (i.e., this list) is structurally modified in
jaroslav@557: * any way other than via the returned list. (Structural modifications are
jaroslav@557: * those that change the size of this list, or otherwise perturb it in such
jaroslav@557: * a fashion that iterations in progress may yield incorrect results.)
jaroslav@557: *
jaroslav@557: * @param fromIndex low endpoint (inclusive) of the subList
jaroslav@557: * @param toIndex high endpoint (exclusive) of the subList
jaroslav@557: * @return a view of the specified range within this list
jaroslav@557: * @throws IndexOutOfBoundsException for an illegal endpoint index value
jaroslav@557: * (fromIndex < 0 || toIndex > size ||
jaroslav@557: * fromIndex > toIndex)
jaroslav@557: */
jaroslav@557: List
jaroslav@557: * String[] y = x.toArray(new String[0]);
jaroslav@557: *
jaroslav@557: * Note that toArray(new Object[0]) is identical in function to
jaroslav@557: * toArray().
jaroslav@557: *
jaroslav@557: * @param a the array into which the elements of this list are to
jaroslav@557: * be stored, if it is big enough; otherwise, a new array of the
jaroslav@557: * same runtime type is allocated for this purpose.
jaroslav@557: * @return an array containing the elements of this list
jaroslav@557: * @throws ArrayStoreException if the runtime type of the specified array
jaroslav@557: * is not a supertype of the runtime type of every element in
jaroslav@557: * this list
jaroslav@557: * @throws NullPointerException if the specified array is null
jaroslav@557: */
jaroslav@557:
jaroslav@557: * int hashCode = 1;
jaroslav@557: * for (E e : list)
jaroslav@557: * hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
jaroslav@557: *
jaroslav@557: * This ensures that list1.equals(list2) implies that
jaroslav@557: * list1.hashCode()==list2.hashCode() for any two lists,
jaroslav@557: * list1 and list2, as required by the general
jaroslav@557: * contract of {@link Object#hashCode}.
jaroslav@557: *
jaroslav@557: * @return the hash code value for this list
jaroslav@557: * @see Object#equals(Object)
jaroslav@557: * @see #equals(Object)
jaroslav@557: */
jaroslav@557: int hashCode();
jaroslav@557:
jaroslav@557:
jaroslav@557: // Positional Access Operations
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Returns the element at the specified position in this list.
jaroslav@557: *
jaroslav@557: * @param index index of the element to return
jaroslav@557: * @return the element at the specified position in this list
jaroslav@557: * @throws IndexOutOfBoundsException if the index is out of range
jaroslav@557: * (index < 0 || index >= size())
jaroslav@557: */
jaroslav@557: E get(int index);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Replaces the element at the specified position in this list with the
jaroslav@557: * specified element (optional operation).
jaroslav@557: *
jaroslav@557: * @param index index of the element to replace
jaroslav@557: * @param element element to be stored at the specified position
jaroslav@557: * @return the element previously at the specified position
jaroslav@557: * @throws UnsupportedOperationException if the set operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws ClassCastException if the class of the specified element
jaroslav@557: * prevents it from being added to this list
jaroslav@557: * @throws NullPointerException if the specified element is null and
jaroslav@557: * this list does not permit null elements
jaroslav@557: * @throws IllegalArgumentException if some property of the specified
jaroslav@557: * element prevents it from being added to this list
jaroslav@557: * @throws IndexOutOfBoundsException if the index is out of range
jaroslav@557: * (index < 0 || index >= size())
jaroslav@557: */
jaroslav@557: E set(int index, E element);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Inserts the specified element at the specified position in this list
jaroslav@557: * (optional operation). Shifts the element currently at that position
jaroslav@557: * (if any) and any subsequent elements to the right (adds one to their
jaroslav@557: * indices).
jaroslav@557: *
jaroslav@557: * @param index index at which the specified element is to be inserted
jaroslav@557: * @param element element to be inserted
jaroslav@557: * @throws UnsupportedOperationException if the add operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws ClassCastException if the class of the specified element
jaroslav@557: * prevents it from being added to this list
jaroslav@557: * @throws NullPointerException if the specified element is null and
jaroslav@557: * this list does not permit null elements
jaroslav@557: * @throws IllegalArgumentException if some property of the specified
jaroslav@557: * element prevents it from being added to this list
jaroslav@557: * @throws IndexOutOfBoundsException if the index is out of range
jaroslav@557: * (index < 0 || index > size())
jaroslav@557: */
jaroslav@557: void add(int index, E element);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Removes the element at the specified position in this list (optional
jaroslav@557: * operation). Shifts any subsequent elements to the left (subtracts one
jaroslav@557: * from their indices). Returns the element that was removed from the
jaroslav@557: * list.
jaroslav@557: *
jaroslav@557: * @param index the index of the element to be removed
jaroslav@557: * @return the element previously at the specified position
jaroslav@557: * @throws UnsupportedOperationException if the remove operation
jaroslav@557: * is not supported by this list
jaroslav@557: * @throws IndexOutOfBoundsException if the index is out of range
jaroslav@557: * (index < 0 || index >= size())
jaroslav@557: */
jaroslav@557: E remove(int index);
jaroslav@557:
jaroslav@557:
jaroslav@557: // Search Operations
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Returns the index of the first occurrence of the specified element
jaroslav@557: * in this list, or -1 if this list does not contain the element.
jaroslav@557: * More formally, returns the lowest index i such that
jaroslav@557: * (o==null ? get(i)==null : o.equals(get(i))),
jaroslav@557: * or -1 if there is no such index.
jaroslav@557: *
jaroslav@557: * @param o element to search for
jaroslav@557: * @return the index of the first occurrence of the specified element in
jaroslav@557: * this list, or -1 if this list does not contain the element
jaroslav@557: * @throws ClassCastException if the type of the specified element
jaroslav@557: * is incompatible with this list
jaroslav@557: * (optional)
jaroslav@557: * @throws NullPointerException if the specified element is null and this
jaroslav@557: * list does not permit null elements
jaroslav@557: * (optional)
jaroslav@557: */
jaroslav@557: int indexOf(Object o);
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Returns the index of the last occurrence of the specified element
jaroslav@557: * in this list, or -1 if this list does not contain the element.
jaroslav@557: * More formally, returns the highest index i such that
jaroslav@557: * (o==null ? get(i)==null : o.equals(get(i))),
jaroslav@557: * or -1 if there is no such index.
jaroslav@557: *
jaroslav@557: * @param o element to search for
jaroslav@557: * @return the index of the last occurrence of the specified element in
jaroslav@557: * this list, or -1 if this list does not contain the element
jaroslav@557: * @throws ClassCastException if the type of the specified element
jaroslav@557: * is incompatible with this list
jaroslav@557: * (optional)
jaroslav@557: * @throws NullPointerException if the specified element is null and this
jaroslav@557: * list does not permit null elements
jaroslav@557: * (optional)
jaroslav@557: */
jaroslav@557: int lastIndexOf(Object o);
jaroslav@557:
jaroslav@557:
jaroslav@557: // List Iterators
jaroslav@557:
jaroslav@557: /**
jaroslav@557: * Returns a list iterator over the elements in this list (in proper
jaroslav@557: * sequence).
jaroslav@557: *
jaroslav@557: * @return a list iterator over the elements in this list (in proper
jaroslav@557: * sequence)
jaroslav@557: */
jaroslav@557: ListIterator
jaroslav@557: * list.subList(from, to).clear();
jaroslav@557: *
jaroslav@557: * Similar idioms may be constructed for indexOf and
jaroslav@557: * lastIndexOf, and all of the algorithms in the
jaroslav@557: * Collections class can be applied to a subList.