*
This method is equivalent to {@link java.util.LinkedList#addLast}. * * @param e element to be appended to this list * @return {@code true} (as specified by {@link java.util.Collection#add}) */ @Override public boolean add(E e) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Inserts the specified element at the specified position in this list. * Shifts the element currently at that position (if any) and any * subsequent elements to the right (adds one to their indices). * * @param index index at which the specified element is to be inserted * @param element element to be inserted * @throws IndexOutOfBoundsException if the index is out of range * (index < 0 || index > size()) */ @Override public void add(int index, E element) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Removes all of the elements from this list. * The list will be empty after this call returns. */ @Override public void clear() { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Returns {@code true} if this list contains the specified element. * More formally, returns {@code true} if and only if this list contains * at least one element {@code e} such that * (o==null ? e==null : o.equals(e)). * * @param o element whose presence in this list is to be tested * @return {@code true} if this list contains the specified element */ @Override public boolean contains(Object o) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Returns the element at the specified position in this list. * * @param index index of the element to return * @return the element at the specified position in this list * @throws IndexOutOfBoundsException if the index is out of range * (index < 0 || index >= size()) */ @Override public E get(int index) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Returns the index of the first occurrence of the specified element * in this list, or -1 if this list does not contain the element. * More formally, returns the lowest index {@code i} such that * (o==null ? get(i)==null : o.equals(get(i))), * or -1 if there is no such index. * * @param o element to search for * @return the index of the first occurrence of the specified element in * this list, or -1 if this list does not contain the element */ @Override public int indexOf(Object o) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Returns true if this list contains no elements. * * @return true if this list contains no elements */ @Override public boolean isEmpty() { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Removes the element at the specified position in this list. Shifts any * subsequent elements to the left (subtracts one from their indices). * Returns the element that was removed from the list. * * @param index the index of the element to be removed * @return the element previously at the specified position * @throws IndexOutOfBoundsException if the index is out of range * (index < 0 || index >= size()) */ @Override public E remove(int index) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Removes the first occurrence of the specified element from this list, * if it is present. If this list does not contain the element, it is * unchanged. More formally, removes the element with the lowest index * {@code i} such that * (o==null ? get(i)==null : o.equals(get(i))) * (if such an element exists). Returns {@code true} if this list * contained the specified element (or equivalently, if this list * changed as a result of the call). * * @param o element to be removed from this list, if present * @return {@code true} if this list contained the specified element */ @Override public boolean remove(Object o) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Replaces the element at the specified position in this list with the * specified element. * * @param index index of the element to replace * @param element element to be stored at the specified position * @return the element previously at the specified position * @throws IndexOutOfBoundsException if the index is out of range * (index < 0 || index >= size()) */ @Override public E set(int index, E element) { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Returns the number of elements in this list. * * @return the number of elements in this list */ @Override public int size() { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Returns an array containing all of the elements in this list * in proper sequence (from first to last element). *
*
The returned array will be "safe" in that no references to it are * maintained by this list. (In other words, this method must allocate * a new array). The caller is thus free to modify the returned array. *
*
This method acts as bridge between array-based and collection-based * APIs. * * @return an array containing all of the elements in this list * in proper sequence */ @Override public Object[] toArray() { throw new UnsupportedOperationException("This method isn't written yet."); } /** * Returns an iterator over the elements in this list (in proper * sequence).
*
* This implementation merely returns a list iterator over the list.
*
* @return an iterator over the elements in this list (in proper sequence)
*/
@Override
public Iterator
* If the list fits in the specified array with room to spare
* (i.e., the array has more elements than the list), the element in
* the array immediately following the end of the collection is set to
* null. (This is useful in determining the length of the
* list only if the caller knows that the list does not contain
* any null elements.)
*
* @param a the array into which the elements of the list are to
* be stored, if it is big enough; otherwise, a new array of the
* same runtime type is allocated for this purpose.
* @return an array containing the elements of the list
* @throws ArrayStoreException if the runtime type of the specified array
* is not a supertype of the runtime type of every element in
* this list
* @throws NullPointerException if the specified array is null
*/
@Override
public
* The returned list iterator is fail-fast.
*
* @param index
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
@Override
public ListIterator
* The returned list iterator is fail-fast.
*
* @see #listIterator(int)
*/
@Override
public ListIterator
* This method eliminates the need for explicit range operations (of
* the sort that commonly exist for arrays). Any operation that expects
* a list can be used as a range operation by passing a subList view
* instead of a whole list. For example, the following idiom
* removes a range of elements from a list:
*
* The semantics of the list returned by this method become undefined if
* the backing list (i.e., this list) is structurally modified in
* any way other than via the returned list. (Structural modifications are
* those that change the size of this list, or otherwise perturb it in such
* a fashion that iterations in progress may yield incorrect results.)
*
* @param fromIndex
* @param toIndex
* @throws IndexOutOfBoundsException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
*/
@Override
public List
* The {@code Spliterator} reports {@link java.util.Spliterator#SIZED},
* {@link java.util.Spliterator#SUBSIZED}, and {@link java.util.Spliterator#ORDERED}.
* Overriding implementations should document the reporting of additional
* characteristic values.
*
* @return a {@code Spliterator} over the elements in this list
* @since 1.8
*/
@Override
public Spliterator
*
* This implementation first checks if the specified object is this
* list. If so, it returns {@code true}; if not, it checks if the
* specified object is a list. If not, it returns {@code false}; if so,
* it iterates over both lists, comparing corresponding pairs of elements.
* If any comparison returns {@code false}, this method returns
* {@code false}. If either iterator runs out of elements before the
* other it returns {@code false} (as the lists are of unequal length);
* otherwise it returns {@code true} when the iterations complete.
*
* @param o the object to be compared for equality with this list
* @return {@code true} if the specified object is equal to this list
*/
@Override
public boolean equals(Object o) {
return super.equals(o);
}
/**
* Returns the hash code value for this list.
*
* This implementation uses exactly the code that is used to define the
* list hash function in the documentation for the {@link java.util.List#hashCode}
* method.
*
* @return the hash code value for this list
*/
@Override
public int hashCode() {
return super.hashCode();
}
/**
* {@inheritDoc}
*
* This implementation iterates over the specified collection,
* checking each element returned by the iterator in turn to see
* if it's contained in this collection. If all elements are so
* contained true is returned, otherwise false.
*
* @param c
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
* @see #contains(Object)
*/
@Override
public boolean containsAll(Collection> c) {
return super.containsAll(c);
}
/**
* Returns a string representation of this collection. The string
* representation consists of a list of the collection's elements in the
* order they are returned by its iterator, enclosed in square brackets
* ("[]"). Adjacent elements are separated by the characters
* ", " (comma and space). Elements are converted to strings as
* by {@link String#valueOf(Object)}.
*
* @return a string representation of this collection
*/
@Override
public String toString() {
return super.toString();
}
/**
* Returns a sequential {@code Stream} with this collection as its source.
*
* This method should be overridden when the {@link #spliterator()}
* method cannot return a spliterator that is {@code IMMUTABLE},
* {@code CONCURRENT}, or late-binding. (See {@link #spliterator()}
* for details.)
*
* @return a sequential {@code Stream} over the elements in this collection
* @implSpec The default implementation creates a sequential {@code Stream} from the
* collection's {@code Spliterator}.
* @since 1.8
*/
@Override
public Stream
* This method should be overridden when the {@link #spliterator()}
* method cannot return a spliterator that is {@code IMMUTABLE},
* {@code CONCURRENT}, or late-binding. (See {@link #spliterator()}
* for details.)
*
* @return a possibly parallel {@code Stream} over the elements in this
* collection
* @implSpec The default implementation creates a parallel {@code Stream} from the
* collection's {@code Spliterator}.
* @since 1.8
*/
@Override
public Stream
* The general contract of {@code finalize} is that it is invoked
* if and when the Java™ virtual
* machine has determined that there is no longer any
* means by which this object can be accessed by any thread that has
* not yet died, except as a result of an action taken by the
* finalization of some other object or class which is ready to be
* finalized. The {@code finalize} method may take any action, including
* making this object available again to other threads; the usual purpose
* of {@code finalize}, however, is to perform cleanup actions before
* the object is irrevocably discarded. For example, the finalize method
* for an object that represents an input/output connection might perform
* explicit I/O transactions to break the connection before the object is
* permanently discarded.
*
* The {@code finalize} method of class {@code Object} performs no
* special action; it simply returns normally. Subclasses of
* {@code Object} may override this definition.
*
* The Java programming language does not guarantee which thread will
* invoke the {@code finalize} method for any given object. It is
* guaranteed, however, that the thread that invokes finalize will not
* be holding any user-visible synchronization locks when finalize is
* invoked. If an uncaught exception is thrown by the finalize method,
* the exception is ignored and finalization of that object terminates.
*
* After the {@code finalize} method has been invoked for an object, no
* further action is taken until the Java virtual machine has again
* determined that there is no longer any means by which this object can
* be accessed by any thread that has not yet died, including possible
* actions by other objects or classes which are ready to be finalized,
* at which point the object may be discarded.
*
* The {@code finalize} method is never invoked more than once by a Java
* virtual machine for any given object.
*
* Any exception thrown by the {@code finalize} method causes
* the finalization of this object to be halted, but is otherwise
* ignored.
*
* @throws Throwable the {@code Exception} raised by this method
* @jls 12.6 Finalization of Class Instances
* @see java.lang.ref.WeakReference
* @see java.lang.ref.PhantomReference
*/
@Override
protected void finalize() throws Throwable {
super.finalize();
}
}
* list.subList(from, to).clear();
*
* Similar idioms may be constructed for {@link #indexOf(Object)} and
* {@link #lastIndexOf(Object)}, and all of the algorithms in the
* {@link java.util.Collections} class can be applied to a subList.
*