10.47/3.74 YES 10.60/3.76 proof of /export/starexec/sandbox2/benchmark/theBenchmark.jar 10.60/3.76 # AProVE Commit ID: 48fb2092695e11cc9f56e44b17a92a5f88ffb256 marcel 20180622 unpublished dirty 10.60/3.76 10.60/3.76 10.60/3.76 termination of the given Bare JBC problem could be proven: 10.60/3.76 10.60/3.76 (0) Bare JBC problem 10.60/3.76 (1) BareJBCToJBCProof [EQUIVALENT, 96 ms] 10.60/3.76 (2) JBC problem 10.60/3.76 (3) JBCToGraph [EQUIVALENT, 933 ms] 10.60/3.76 (4) JBCTerminationGraph 10.60/3.76 (5) TerminationGraphToSCCProof [SOUND, 0 ms] 10.60/3.76 (6) JBCTerminationSCC 10.60/3.76 (7) SCCToIRSProof [SOUND, 261 ms] 10.60/3.76 (8) IRSwT 10.60/3.76 (9) IRSFormatTransformerProof [EQUIVALENT, 0 ms] 10.60/3.76 (10) IRSwT 10.60/3.76 (11) IRSwTTerminationDigraphProof [EQUIVALENT, 26 ms] 10.60/3.76 (12) IRSwT 10.60/3.76 (13) IntTRSCompressionProof [EQUIVALENT, 0 ms] 10.60/3.76 (14) IRSwT 10.60/3.76 (15) TempFilterProof [SOUND, 48 ms] 10.60/3.76 (16) IntTRS 10.60/3.76 (17) PolynomialOrderProcessor [EQUIVALENT, 16 ms] 10.60/3.76 (18) YES 10.60/3.76 10.60/3.76 10.60/3.76 ---------------------------------------- 10.60/3.76 10.60/3.76 (0) 10.60/3.76 Obligation: 10.60/3.76 need to prove termination of the following program: 10.60/3.76 /* 10.60/3.76 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.76 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.76 * 10.60/3.76 * This code is free software; you can redistribute it and/or modify it 10.60/3.76 * under the terms of the GNU General Public License version 2 only, as 10.60/3.76 * published by the Free Software Foundation. Sun designates this 10.60/3.76 * particular file as subject to the "Classpath" exception as provided 10.60/3.76 * by Sun in the LICENSE file that accompanied this code. 10.60/3.76 * 10.60/3.76 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.76 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.76 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.76 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.76 * accompanied this code). 10.60/3.76 * 10.60/3.76 * You should have received a copy of the GNU General Public License version 10.60/3.76 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.76 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.76 * 10.60/3.76 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.76 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.76 * have any questions. 10.60/3.76 */ 10.60/3.76 10.60/3.76 package javaUtilEx; 10.60/3.76 10.60/3.76 /** 10.60/3.76 * This class provides a skeletal implementation of the Collection 10.60/3.76 * interface, to minimize the effort required to implement this interface.

10.60/3.76 * 10.60/3.76 * To implement an unmodifiable collection, the programmer needs only to 10.60/3.76 * extend this class and provide implementations for the iterator and 10.60/3.76 * size methods. (The iterator returned by the iterator 10.60/3.76 * method must implement hasNext and next.)

10.60/3.76 * 10.60/3.76 * To implement a modifiable collection, the programmer must additionally 10.60/3.76 * override this class's add method (which otherwise throws an 10.60/3.76 * UnsupportedOperationException), and the iterator returned by the 10.60/3.76 * iterator method must additionally implement its remove 10.60/3.76 * method.

10.60/3.76 * 10.60/3.76 * The programmer should generally provide a void (no argument) and 10.60/3.76 * Collection constructor, as per the recommendation in the 10.60/3.76 * Collection interface specification.

10.60/3.76 * 10.60/3.76 * The documentation for each non-abstract method in this class describes its 10.60/3.76 * implementation in detail. Each of these methods may be overridden if 10.60/3.76 * the collection being implemented admits a more efficient implementation.

10.60/3.76 * 10.60/3.76 * This class is a member of the 10.60/3.76 * 10.60/3.76 * Java Collections Framework. 10.60/3.76 * 10.60/3.76 * @author Josh Bloch 10.60/3.76 * @author Neal Gafter 10.60/3.76 * @see Collection 10.60/3.76 * @since 1.2 10.60/3.76 */ 10.60/3.76 10.60/3.76 public abstract class AbstractCollection implements Collection { 10.60/3.76 /** 10.60/3.76 * Sole constructor. (For invocation by subclass constructors, typically 10.60/3.76 * implicit.) 10.60/3.76 */ 10.60/3.76 protected AbstractCollection() { 10.60/3.76 } 10.60/3.76 10.60/3.76 // Query Operations 10.60/3.76 10.60/3.76 /** 10.60/3.76 * Returns an iterator over the elements contained in this collection. 10.60/3.76 * 10.60/3.76 * @return an iterator over the elements contained in this collection 10.60/3.76 */ 10.60/3.76 public abstract Iterator iterator(); 10.60/3.76 10.60/3.76 public abstract int size(); 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation returns size() == 0. 10.60/3.76 */ 10.60/3.76 public boolean isEmpty() { 10.60/3.76 return size() == 0; 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation iterates over the elements in the collection, 10.60/3.76 * checking each element in turn for equality with the specified element. 10.60/3.76 * 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public boolean contains(Object o) { 10.60/3.76 Iterator e = iterator(); 10.60/3.76 if (o==null) { 10.60/3.76 while (e.hasNext()) 10.60/3.76 if (e.next()==null) 10.60/3.76 return true; 10.60/3.76 } else { 10.60/3.76 while (e.hasNext()) 10.60/3.76 if (o.equals(e.next())) 10.60/3.76 return true; 10.60/3.76 } 10.60/3.76 return false; 10.60/3.76 } 10.60/3.76 10.60/3.76 // Modification Operations 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation always throws an 10.60/3.76 * UnsupportedOperationException. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.76 * @throws IllegalStateException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public boolean add(E e) { 10.60/3.76 throw new UnsupportedOperationException(); 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation iterates over the collection looking for the 10.60/3.76 * specified element. If it finds the element, it removes the element 10.60/3.76 * from the collection using the iterator's remove method. 10.60/3.76 * 10.60/3.76 *

Note that this implementation throws an 10.60/3.76 * UnsupportedOperationException if the iterator returned by this 10.60/3.76 * collection's iterator method does not implement the remove 10.60/3.76 * method and this collection contains the specified object. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public boolean remove(Object o) { 10.60/3.76 Iterator e = iterator(); 10.60/3.76 if (o==null) { 10.60/3.76 while (e.hasNext()) { 10.60/3.76 if (e.next()==null) { 10.60/3.76 e.remove(); 10.60/3.76 return true; 10.60/3.76 } 10.60/3.76 } 10.60/3.76 } else { 10.60/3.76 while (e.hasNext()) { 10.60/3.76 if (o.equals(e.next())) { 10.60/3.76 e.remove(); 10.60/3.76 return true; 10.60/3.76 } 10.60/3.76 } 10.60/3.76 } 10.60/3.76 return false; 10.60/3.76 } 10.60/3.76 10.60/3.76 10.60/3.76 // Bulk Operations 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation iterates over the specified collection, 10.60/3.76 * checking each element returned by the iterator in turn to see 10.60/3.76 * if it's contained in this collection. If all elements are so 10.60/3.76 * contained true is returned, otherwise false. 10.60/3.76 * 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * @see #contains(Object) 10.60/3.76 */ 10.60/3.76 public boolean containsAll(Collection c) { 10.60/3.76 Iterator e = c.iterator(); 10.60/3.76 while (e.hasNext()) 10.60/3.76 if (!contains(e.next())) 10.60/3.76 return false; 10.60/3.76 return true; 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation iterates over the specified collection, and adds 10.60/3.76 * each object returned by the iterator to this collection, in turn. 10.60/3.76 * 10.60/3.76 *

Note that this implementation will throw an 10.60/3.76 * UnsupportedOperationException unless add is 10.60/3.76 * overridden (assuming the specified collection is non-empty). 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.76 * @throws IllegalStateException {@inheritDoc} 10.60/3.76 * 10.60/3.76 * @see #add(Object) 10.60/3.76 */ 10.60/3.76 public boolean addAll(Collection c) { 10.60/3.76 boolean modified = false; 10.60/3.76 Iterator e = c.iterator(); 10.60/3.76 while (e.hasNext()) { 10.60/3.76 if (add(e.next())) 10.60/3.76 modified = true; 10.60/3.76 } 10.60/3.76 return modified; 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation iterates over this collection, checking each 10.60/3.76 * element returned by the iterator in turn to see if it's contained 10.60/3.76 * in the specified collection. If it's so contained, it's removed from 10.60/3.76 * this collection with the iterator's remove method. 10.60/3.76 * 10.60/3.76 *

Note that this implementation will throw an 10.60/3.76 * UnsupportedOperationException if the iterator returned by the 10.60/3.76 * iterator method does not implement the remove method 10.60/3.76 * and this collection contains one or more elements in common with the 10.60/3.76 * specified collection. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * 10.60/3.76 * @see #remove(Object) 10.60/3.76 * @see #contains(Object) 10.60/3.76 */ 10.60/3.76 public boolean removeAll(Collection c) { 10.60/3.76 boolean modified = false; 10.60/3.76 Iterator e = iterator(); 10.60/3.76 while (e.hasNext()) { 10.60/3.76 if (c.contains(e.next())) { 10.60/3.76 e.remove(); 10.60/3.76 modified = true; 10.60/3.76 } 10.60/3.76 } 10.60/3.76 return modified; 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation iterates over this collection, checking each 10.60/3.76 * element returned by the iterator in turn to see if it's contained 10.60/3.76 * in the specified collection. If it's not so contained, it's removed 10.60/3.76 * from this collection with the iterator's remove method. 10.60/3.76 * 10.60/3.76 *

Note that this implementation will throw an 10.60/3.76 * UnsupportedOperationException if the iterator returned by the 10.60/3.76 * iterator method does not implement the remove method 10.60/3.76 * and this collection contains one or more elements not present in the 10.60/3.76 * specified collection. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * 10.60/3.76 * @see #remove(Object) 10.60/3.76 * @see #contains(Object) 10.60/3.76 */ 10.60/3.76 public boolean retainAll(Collection c) { 10.60/3.76 boolean modified = false; 10.60/3.76 Iterator e = iterator(); 10.60/3.76 while (e.hasNext()) { 10.60/3.76 if (!c.contains(e.next())) { 10.60/3.76 e.remove(); 10.60/3.76 modified = true; 10.60/3.76 } 10.60/3.76 } 10.60/3.76 return modified; 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation iterates over this collection, removing each 10.60/3.76 * element using the Iterator.remove operation. Most 10.60/3.76 * implementations will probably choose to override this method for 10.60/3.76 * efficiency. 10.60/3.76 * 10.60/3.76 *

Note that this implementation will throw an 10.60/3.76 * UnsupportedOperationException if the iterator returned by this 10.60/3.76 * collection's iterator method does not implement the 10.60/3.76 * remove method and this collection is non-empty. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public void clear() { 10.60/3.76 Iterator e = iterator(); 10.60/3.76 while (e.hasNext()) { 10.60/3.76 e.next(); 10.60/3.76 e.remove(); 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 10.60/3.76 // String conversion 10.60/3.76 10.60/3.76 /** 10.60/3.76 * Returns a string representation of this collection. The string 10.60/3.76 * representation consists of a list of the collection's elements in the 10.60/3.76 * order they are returned by its iterator, enclosed in square brackets 10.60/3.76 * ("[]"). Adjacent elements are separated by the characters 10.60/3.76 * ", " (comma and space). Elements are converted to strings as 10.60/3.76 * by {@link String#valueOf(Object)}. 10.60/3.76 * 10.60/3.76 * @return a string representation of this collection 10.60/3.76 */ 10.60/3.76 public String toString() { 10.60/3.76 Iterator i = iterator(); 10.60/3.76 if (! i.hasNext()) 10.60/3.76 return "[]"; 10.60/3.76 10.60/3.76 String sb = ""; 10.60/3.76 sb = sb + "["; 10.60/3.76 for (;;) { 10.60/3.76 E e = i.next(); 10.60/3.76 sb = sb + (e == this ? "(this Collection)" : e); 10.60/3.76 if (! i.hasNext()) { 10.60/3.76 sb = sb + "]"; 10.60/3.76 return sb; 10.60/3.76 } 10.60/3.76 sb = sb + ", "; 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 } 10.60/3.76 10.60/3.76 10.60/3.76 /* 10.60/3.76 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.76 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.76 * 10.60/3.76 * This code is free software; you can redistribute it and/or modify it 10.60/3.76 * under the terms of the GNU General Public License version 2 only, as 10.60/3.76 * published by the Free Software Foundation. Sun designates this 10.60/3.76 * particular file as subject to the "Classpath" exception as provided 10.60/3.76 * by Sun in the LICENSE file that accompanied this code. 10.60/3.76 * 10.60/3.76 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.76 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.76 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.76 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.76 * accompanied this code). 10.60/3.76 * 10.60/3.76 * You should have received a copy of the GNU General Public License version 10.60/3.76 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.76 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.76 * 10.60/3.76 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.76 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.76 * have any questions. 10.60/3.76 */ 10.60/3.76 10.60/3.76 package javaUtilEx; 10.60/3.76 10.60/3.76 /** 10.60/3.76 * This class provides a skeletal implementation of the {@link List} 10.60/3.76 * interface to minimize the effort required to implement this interface 10.60/3.76 * backed by a "random access" data store (such as an array). For sequential 10.60/3.76 * access data (such as a linked list), {@link AbstractSequentialList} should 10.60/3.76 * be used in preference to this class. 10.60/3.76 * 10.60/3.76 *

To implement an unmodifiable list, the programmer needs only to extend 10.60/3.76 * this class and provide implementations for the {@link #get(int)} and 10.60/3.76 * {@link List#size() size()} methods. 10.60/3.76 * 10.60/3.76 *

To implement a modifiable list, the programmer must additionally 10.60/3.76 * override the {@link #set(int, Object) set(int, E)} method (which otherwise 10.60/3.76 * throws an {@code UnsupportedOperationException}). If the list is 10.60/3.76 * variable-size the programmer must additionally override the 10.60/3.76 * {@link #add(int, Object) add(int, E)} and {@link #remove(int)} methods. 10.60/3.76 * 10.60/3.76 *

The programmer should generally provide a void (no argument) and collection 10.60/3.76 * constructor, as per the recommendation in the {@link Collection} interface 10.60/3.76 * specification. 10.60/3.76 * 10.60/3.76 *

Unlike the other abstract collection implementations, the programmer does 10.60/3.76 * not have to provide an iterator implementation; the iterator and 10.60/3.76 * list iterator are implemented by this class, on top of the "random access" 10.60/3.76 * methods: 10.60/3.76 * {@link #get(int)}, 10.60/3.76 * {@link #set(int, Object) set(int, E)}, 10.60/3.76 * {@link #add(int, Object) add(int, E)} and 10.60/3.76 * {@link #remove(int)}. 10.60/3.76 * 10.60/3.76 *

The documentation for each non-abstract method in this class describes its 10.60/3.76 * implementation in detail. Each of these methods may be overridden if the 10.60/3.76 * collection being implemented admits a more efficient implementation. 10.60/3.76 * 10.60/3.76 *

This class is a member of the 10.60/3.76 * 10.60/3.76 * Java Collections Framework. 10.60/3.76 * 10.60/3.76 * @author Josh Bloch 10.60/3.76 * @author Neal Gafter 10.60/3.76 * @since 1.2 10.60/3.76 */ 10.60/3.76 10.60/3.76 public abstract class AbstractList extends AbstractCollection implements List { 10.60/3.76 /** 10.60/3.76 * Sole constructor. (For invocation by subclass constructors, typically 10.60/3.76 * implicit.) 10.60/3.76 */ 10.60/3.76 protected AbstractList() { 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * Appends the specified element to the end of this list (optional 10.60/3.76 * operation). 10.60/3.76 * 10.60/3.76 *

Lists that support this operation may place limitations on what 10.60/3.76 * elements may be added to this list. In particular, some 10.60/3.76 * lists will refuse to add null elements, and others will impose 10.60/3.76 * restrictions on the type of elements that may be added. List 10.60/3.76 * classes should clearly specify in their documentation any restrictions 10.60/3.76 * on what elements may be added. 10.60/3.76 * 10.60/3.76 *

This implementation calls {@code add(size(), e)}. 10.60/3.76 * 10.60/3.76 *

Note that this implementation throws an 10.60/3.76 * {@code UnsupportedOperationException} unless 10.60/3.76 * {@link #add(int, Object) add(int, E)} is overridden. 10.60/3.76 * 10.60/3.76 * @param e element to be appended to this list 10.60/3.76 * @return {@code true} (as specified by {@link Collection#add}) 10.60/3.76 * @throws UnsupportedOperationException if the {@code add} operation 10.60/3.76 * is not supported by this list 10.60/3.76 * @throws ClassCastException if the class of the specified element 10.60/3.76 * prevents it from being added to this list 10.60/3.76 * @throws NullPointerException if the specified element is null and this 10.60/3.76 * list does not permit null elements 10.60/3.76 * @throws IllegalArgumentException if some property of this element 10.60/3.76 * prevents it from being added to this list 10.60/3.76 */ 10.60/3.76 public boolean add(E e) { 10.60/3.76 add(size(), e); 10.60/3.76 return true; 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 abstract public E get(int index); 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation always throws an 10.60/3.76 * {@code UnsupportedOperationException}. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.76 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public E set(int index, E element) { 10.60/3.76 throw new UnsupportedOperationException(); 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation always throws an 10.60/3.76 * {@code UnsupportedOperationException}. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.76 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public void add(int index, E element) { 10.60/3.76 throw new UnsupportedOperationException(); 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation always throws an 10.60/3.76 * {@code UnsupportedOperationException}. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public E remove(int index) { 10.60/3.76 throw new UnsupportedOperationException(); 10.60/3.76 } 10.60/3.76 10.60/3.76 10.60/3.76 // Search Operations 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation first gets a list iterator (with 10.60/3.76 * {@code listIterator()}). Then, it iterates over the list until the 10.60/3.76 * specified element is found or the end of the list is reached. 10.60/3.76 * 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public int indexOf(Object o) { 10.60/3.76 ListIterator e = listIterator(); 10.60/3.76 if (o==null) { 10.60/3.76 while (e.hasNext()) 10.60/3.76 if (e.next()==null) 10.60/3.76 return e.previousIndex(); 10.60/3.76 } else { 10.60/3.76 while (e.hasNext()) 10.60/3.76 if (o.equals(e.next())) 10.60/3.76 return e.previousIndex(); 10.60/3.76 } 10.60/3.76 return -1; 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation first gets a list iterator that points to the end 10.60/3.76 * of the list (with {@code listIterator(size())}). Then, it iterates 10.60/3.76 * backwards over the list until the specified element is found, or the 10.60/3.76 * beginning of the list is reached. 10.60/3.76 * 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public int lastIndexOf(Object o) { 10.60/3.76 ListIterator e = listIterator(size()); 10.60/3.76 if (o==null) { 10.60/3.76 while (e.hasPrevious()) 10.60/3.76 if (e.previous()==null) 10.60/3.76 return e.nextIndex(); 10.60/3.76 } else { 10.60/3.76 while (e.hasPrevious()) 10.60/3.76 if (o.equals(e.previous())) 10.60/3.76 return e.nextIndex(); 10.60/3.76 } 10.60/3.76 return -1; 10.60/3.76 } 10.60/3.76 10.60/3.76 10.60/3.76 // Bulk Operations 10.60/3.76 10.60/3.76 /** 10.60/3.76 * Removes all of the elements from this list (optional operation). 10.60/3.76 * The list will be empty after this call returns. 10.60/3.76 * 10.60/3.76 *

This implementation calls {@code removeRange(0, size())}. 10.60/3.76 * 10.60/3.76 *

Note that this implementation throws an 10.60/3.76 * {@code UnsupportedOperationException} unless {@code remove(int 10.60/3.76 * index)} or {@code removeRange(int fromIndex, int toIndex)} is 10.60/3.76 * overridden. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException if the {@code clear} operation 10.60/3.76 * is not supported by this list 10.60/3.76 */ 10.60/3.76 public void clear() { 10.60/3.76 removeRange(0, size()); 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation gets an iterator over the specified collection 10.60/3.76 * and iterates over it, inserting the elements obtained from the 10.60/3.76 * iterator into this list at the appropriate position, one at a time, 10.60/3.76 * using {@code add(int, E)}. 10.60/3.76 * Many implementations will override this method for efficiency. 10.60/3.76 * 10.60/3.76 *

Note that this implementation throws an 10.60/3.76 * {@code UnsupportedOperationException} unless 10.60/3.76 * {@link #add(int, Object) add(int, E)} is overridden. 10.60/3.76 * 10.60/3.76 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.76 * @throws ClassCastException {@inheritDoc} 10.60/3.76 * @throws NullPointerException {@inheritDoc} 10.60/3.76 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.76 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public boolean addAll(int index, Collection c) { 10.60/3.76 rangeCheckForAdd(index); 10.60/3.76 boolean modified = false; 10.60/3.76 Iterator e = c.iterator(); 10.60/3.76 while (e.hasNext()) { 10.60/3.76 add(index++, e.next()); 10.60/3.76 modified = true; 10.60/3.76 } 10.60/3.76 return modified; 10.60/3.76 } 10.60/3.76 10.60/3.76 10.60/3.76 // Iterators 10.60/3.76 10.60/3.76 /** 10.60/3.76 * Returns an iterator over the elements in this list in proper sequence. 10.60/3.76 * 10.60/3.76 *

This implementation returns a straightforward implementation of the 10.60/3.76 * iterator interface, relying on the backing list's {@code size()}, 10.60/3.76 * {@code get(int)}, and {@code remove(int)} methods. 10.60/3.76 * 10.60/3.76 *

Note that the iterator returned by this method will throw an 10.60/3.76 * {@link UnsupportedOperationException} in response to its 10.60/3.76 * {@code remove} method unless the list's {@code remove(int)} method is 10.60/3.76 * overridden. 10.60/3.76 * 10.60/3.76 *

This implementation can be made to throw runtime exceptions in the 10.60/3.76 * face of concurrent modification, as described in the specification 10.60/3.76 * for the (protected) {@link #modCount} field. 10.60/3.76 * 10.60/3.76 * @return an iterator over the elements in this list in proper sequence 10.60/3.76 */ 10.60/3.76 public Iterator iterator() { 10.60/3.76 return new Itr(); 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation returns {@code listIterator(0)}. 10.60/3.76 * 10.60/3.76 * @see #listIterator(int) 10.60/3.76 */ 10.60/3.76 public ListIterator listIterator() { 10.60/3.76 return listIterator(0); 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation returns a straightforward implementation of the 10.60/3.76 * {@code ListIterator} interface that extends the implementation of the 10.60/3.76 * {@code Iterator} interface returned by the {@code iterator()} method. 10.60/3.76 * The {@code ListIterator} implementation relies on the backing list's 10.60/3.76 * {@code get(int)}, {@code set(int, E)}, {@code add(int, E)} 10.60/3.76 * and {@code remove(int)} methods. 10.60/3.76 * 10.60/3.76 *

Note that the list iterator returned by this implementation will 10.60/3.76 * throw an {@link UnsupportedOperationException} in response to its 10.60/3.76 * {@code remove}, {@code set} and {@code add} methods unless the 10.60/3.76 * list's {@code remove(int)}, {@code set(int, E)}, and 10.60/3.76 * {@code add(int, E)} methods are overridden. 10.60/3.76 * 10.60/3.76 *

This implementation can be made to throw runtime exceptions in the 10.60/3.76 * face of concurrent modification, as described in the specification for 10.60/3.76 * the (protected) {@link #modCount} field. 10.60/3.76 * 10.60/3.76 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.76 */ 10.60/3.76 public ListIterator listIterator(final int index) { 10.60/3.76 rangeCheckForAdd(index); 10.60/3.76 10.60/3.76 return new ListItr(index); 10.60/3.76 } 10.60/3.76 10.60/3.76 private class Itr implements Iterator { 10.60/3.76 /** 10.60/3.76 * Index of element to be returned by subsequent call to next. 10.60/3.76 */ 10.60/3.76 int cursor = 0; 10.60/3.76 10.60/3.76 /** 10.60/3.76 * Index of element returned by most recent call to next or 10.60/3.76 * previous. Reset to -1 if this element is deleted by a call 10.60/3.76 * to remove. 10.60/3.76 */ 10.60/3.76 int lastRet = -1; 10.60/3.76 10.60/3.76 /** 10.60/3.76 * The modCount value that the iterator believes that the backing 10.60/3.76 * List should have. If this expectation is violated, the iterator 10.60/3.76 * has detected concurrent modification. 10.60/3.76 */ 10.60/3.76 int expectedModCount = modCount; 10.60/3.76 10.60/3.76 public boolean hasNext() { 10.60/3.76 return cursor != size(); 10.60/3.76 } 10.60/3.76 10.60/3.76 public E next() { 10.60/3.76 checkForComodification(); 10.60/3.76 try { 10.60/3.76 int i = cursor; 10.60/3.76 E next = get(i); 10.60/3.76 lastRet = i; 10.60/3.76 cursor = i + 1; 10.60/3.76 return next; 10.60/3.76 } catch (IndexOutOfBoundsException e) { 10.60/3.76 checkForComodification(); 10.60/3.76 throw new NoSuchElementException(); 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 public void remove() { 10.60/3.76 if (lastRet < 0) 10.60/3.76 throw new IllegalStateException(); 10.60/3.76 checkForComodification(); 10.60/3.76 10.60/3.76 try { 10.60/3.76 AbstractList.this.remove(lastRet); 10.60/3.76 if (lastRet < cursor) 10.60/3.76 cursor--; 10.60/3.76 lastRet = -1; 10.60/3.76 expectedModCount = modCount; 10.60/3.76 } catch (IndexOutOfBoundsException e) { 10.60/3.76 throw new ConcurrentModificationException(); 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 final void checkForComodification() { 10.60/3.76 if (modCount != expectedModCount) 10.60/3.76 throw new ConcurrentModificationException(); 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 private class ListItr extends Itr implements ListIterator { 10.60/3.76 ListItr(int index) { 10.60/3.76 cursor = index; 10.60/3.76 } 10.60/3.76 10.60/3.76 public boolean hasPrevious() { 10.60/3.76 return cursor != 0; 10.60/3.76 } 10.60/3.76 10.60/3.76 public E previous() { 10.60/3.76 checkForComodification(); 10.60/3.76 try { 10.60/3.76 int i = cursor - 1; 10.60/3.76 E previous = get(i); 10.60/3.76 lastRet = cursor = i; 10.60/3.76 return previous; 10.60/3.76 } catch (IndexOutOfBoundsException e) { 10.60/3.76 checkForComodification(); 10.60/3.76 throw new NoSuchElementException(); 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 public int nextIndex() { 10.60/3.76 return cursor; 10.60/3.76 } 10.60/3.76 10.60/3.76 public int previousIndex() { 10.60/3.76 return cursor-1; 10.60/3.76 } 10.60/3.76 10.60/3.76 public void set(E e) { 10.60/3.76 if (lastRet < 0) 10.60/3.76 throw new IllegalStateException(); 10.60/3.76 checkForComodification(); 10.60/3.76 10.60/3.76 try { 10.60/3.76 AbstractList.this.set(lastRet, e); 10.60/3.76 expectedModCount = modCount; 10.60/3.76 } catch (IndexOutOfBoundsException ex) { 10.60/3.76 throw new ConcurrentModificationException(); 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 public void add(E e) { 10.60/3.76 checkForComodification(); 10.60/3.76 10.60/3.76 try { 10.60/3.76 int i = cursor; 10.60/3.76 AbstractList.this.add(i, e); 10.60/3.76 lastRet = -1; 10.60/3.76 cursor = i + 1; 10.60/3.76 expectedModCount = modCount; 10.60/3.76 } catch (IndexOutOfBoundsException ex) { 10.60/3.76 throw new ConcurrentModificationException(); 10.60/3.76 } 10.60/3.76 } 10.60/3.76 } 10.60/3.76 10.60/3.76 /** 10.60/3.76 * {@inheritDoc} 10.60/3.76 * 10.60/3.76 *

This implementation returns a list that subclasses 10.60/3.76 * {@code AbstractList}. The subclass stores, in private fields, the 10.60/3.76 * offset of the subList within the backing list, the size of the subList 10.60/3.76 * (which can change over its lifetime), and the expected 10.60/3.76 * {@code modCount} value of the backing list. There are two variants 10.60/3.76 * of the subclass, one of which implements {@code RandomAccess}. 10.60/3.76 * If this list implements {@code RandomAccess} the returned list will 10.60/3.76 * be an instance of the subclass that implements {@code RandomAccess}. 10.60/3.76 * 10.60/3.76 *

The subclass's {@code set(int, E)}, {@code get(int)}, 10.60/3.76 * {@code add(int, E)}, {@code remove(int)}, {@code addAll(int, 10.60/3.76 * Collection)} and {@code removeRange(int, int)} methods all 10.60/3.76 * delegate to the corresponding methods on the backing abstract list, 10.60/3.76 * after bounds-checking the index and adjusting for the offset. The 10.60/3.76 * {@code addAll(Collection c)} method merely returns {@code addAll(size, 10.60/3.76 * c)}. 10.60/3.76 * 10.60/3.76 *

The {@code listIterator(int)} method returns a "wrapper object" 10.60/3.76 * over a list iterator on the backing list, which is created with the 10.60/3.76 * corresponding method on the backing list. The {@code iterator} method 10.60/3.76 * merely returns {@code listIterator()}, and the {@code size} method 10.60/3.76 * merely returns the subclass's {@code size} field. 10.60/3.76 * 10.60/3.76 *

All methods first check to see if the actual {@code modCount} of 10.60/3.76 * the backing list is equal to its expected value, and throw a 10.60/3.76 * {@code ConcurrentModificationException} if it is not. 10.60/3.76 * 10.60/3.76 * @throws IndexOutOfBoundsException if an endpoint index value is out of range 10.60/3.76 * {@code (fromIndex < 0 || toIndex > size)} 10.60/3.76 * @throws IllegalArgumentException if the endpoint indices are out of order 10.60/3.76 * {@code (fromIndex > toIndex)} 10.60/3.76 */ 10.60/3.76 public List subList(int fromIndex, int toIndex) { 10.60/3.76 return (this instanceof RandomAccess ? 10.60/3.76 new RandomAccessSubList(this, fromIndex, toIndex) : 10.60/3.76 new SubList(this, fromIndex, toIndex)); 10.60/3.76 } 10.60/3.76 10.60/3.76 // Comparison and hashing 10.60/3.76 10.60/3.76 /** 10.60/3.76 * Compares the specified object with this list for equality. Returns 10.60/3.76 * {@code true} if and only if the specified object is also a list, both 10.60/3.76 * lists have the same size, and all corresponding pairs of elements in 10.60/3.76 * the two lists are equal. (Two elements {@code e1} and 10.60/3.76 * {@code e2} are equal if {@code (e1==null ? e2==null : 10.60/3.76 * e1.equals(e2))}.) In other words, two lists are defined to be 10.60/3.76 * equal if they contain the same elements in the same order.

10.60/3.76 * 10.60/3.76 * This implementation first checks if the specified object is this 10.60/3.76 * list. If so, it returns {@code true}; if not, it checks if the 10.60/3.76 * specified object is a list. If not, it returns {@code false}; if so, 10.60/3.76 * it iterates over both lists, comparing corresponding pairs of elements. 10.60/3.76 * If any comparison returns {@code false}, this method returns 10.60/3.76 * {@code false}. If either iterator runs out of elements before the 10.60/3.76 * other it returns {@code false} (as the lists are of unequal length); 10.60/3.76 * otherwise it returns {@code true} when the iterations complete. 10.60/3.76 * 10.60/3.76 * @param o the object to be compared for equality with this list 10.60/3.76 * @return {@code true} if the specified object is equal to this list 10.60/3.76 */ 10.60/3.76 public boolean equals(Object o) { 10.60/3.76 if (o == this) 10.60/3.76 return true; 10.60/3.76 if (!(o instanceof List)) 10.60/3.76 return false; 10.60/3.76 10.60/3.76 ListIterator e1 = listIterator(); 10.60/3.76 ListIterator e2 = ((List) o).listIterator(); 10.60/3.76 while(e1.hasNext() && e2.hasNext()) { 10.60/3.77 E o1 = e1.next(); 10.60/3.77 Object o2 = e2.next(); 10.60/3.77 if (!(o1==null ? o2==null : o1.equals(o2))) 10.60/3.77 return false; 10.60/3.77 } 10.60/3.77 return !(e1.hasNext() || e2.hasNext()); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns the hash code value for this list. 10.60/3.77 * 10.60/3.77 *

This implementation uses exactly the code that is used to define the 10.60/3.77 * list hash function in the documentation for the {@link List#hashCode} 10.60/3.77 * method. 10.60/3.77 * 10.60/3.77 * @return the hash code value for this list 10.60/3.77 */ 10.60/3.77 public int hashCode() { 10.60/3.77 int hashCode = 1; 10.60/3.77 Iterator it = this.iterator(); 10.60/3.77 while (it.hasNext()) { 10.60/3.77 E e = it.next(); 10.60/3.77 hashCode = 31*hashCode + (e==null ? 0 : e.hashCode()); 10.60/3.77 } 10.60/3.77 return hashCode; 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes from this list all of the elements whose index is between 10.60/3.77 * {@code fromIndex}, inclusive, and {@code toIndex}, exclusive. 10.60/3.77 * Shifts any succeeding elements to the left (reduces their index). 10.60/3.77 * This call shortens the list by {@code (toIndex - fromIndex)} elements. 10.60/3.77 * (If {@code toIndex==fromIndex}, this operation has no effect.) 10.60/3.77 * 10.60/3.77 *

This method is called by the {@code clear} operation on this list 10.60/3.77 * and its subLists. Overriding this method to take advantage of 10.60/3.77 * the internals of the list implementation can substantially 10.60/3.77 * improve the performance of the {@code clear} operation on this list 10.60/3.77 * and its subLists. 10.60/3.77 * 10.60/3.77 *

This implementation gets a list iterator positioned before 10.60/3.77 * {@code fromIndex}, and repeatedly calls {@code ListIterator.next} 10.60/3.77 * followed by {@code ListIterator.remove} until the entire range has 10.60/3.77 * been removed. Note: if {@code ListIterator.remove} requires linear 10.60/3.77 * time, this implementation requires quadratic time. 10.60/3.77 * 10.60/3.77 * @param fromIndex index of first element to be removed 10.60/3.77 * @param toIndex index after last element to be removed 10.60/3.77 */ 10.60/3.77 protected void removeRange(int fromIndex, int toIndex) { 10.60/3.77 ListIterator it = listIterator(fromIndex); 10.60/3.77 for (int i=0, n=toIndex-fromIndex; istructurally modified. 10.60/3.77 * Structural modifications are those that change the size of the 10.60/3.77 * list, or otherwise perturb it in such a fashion that iterations in 10.60/3.77 * progress may yield incorrect results. 10.60/3.77 * 10.60/3.77 *

This field is used by the iterator and list iterator implementation 10.60/3.77 * returned by the {@code iterator} and {@code listIterator} methods. 10.60/3.77 * If the value of this field changes unexpectedly, the iterator (or list 10.60/3.77 * iterator) will throw a {@code ConcurrentModificationException} in 10.60/3.77 * response to the {@code next}, {@code remove}, {@code previous}, 10.60/3.77 * {@code set} or {@code add} operations. This provides 10.60/3.77 * fail-fast behavior, rather than non-deterministic behavior in 10.60/3.77 * the face of concurrent modification during iteration. 10.60/3.77 * 10.60/3.77 *

Use of this field by subclasses is optional. If a subclass 10.60/3.77 * wishes to provide fail-fast iterators (and list iterators), then it 10.60/3.77 * merely has to increment this field in its {@code add(int, E)} and 10.60/3.77 * {@code remove(int)} methods (and any other methods that it overrides 10.60/3.77 * that result in structural modifications to the list). A single call to 10.60/3.77 * {@code add(int, E)} or {@code remove(int)} must add no more than 10.60/3.77 * one to this field, or the iterators (and list iterators) will throw 10.60/3.77 * bogus {@code ConcurrentModificationExceptions}. If an implementation 10.60/3.77 * does not wish to provide fail-fast iterators, this field may be 10.60/3.77 * ignored. 10.60/3.77 */ 10.60/3.77 protected transient int modCount = 0; 10.60/3.77 10.60/3.77 private void rangeCheckForAdd(int index) { 10.60/3.77 if (index < 0 || index > size()) 10.60/3.77 throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); 10.60/3.77 } 10.60/3.77 10.60/3.77 private String outOfBoundsMsg(int index) { 10.60/3.77 return ""; 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 class SubList extends AbstractList { 10.60/3.77 private final AbstractList l; 10.60/3.77 private final int offset; 10.60/3.77 private int size; 10.60/3.77 10.60/3.77 SubList(AbstractList list, int fromIndex, int toIndex) { 10.60/3.77 if (fromIndex < 0) 10.60/3.77 throw new IndexOutOfBoundsException(); 10.60/3.77 if (toIndex > list.size()) 10.60/3.77 throw new IndexOutOfBoundsException(); 10.60/3.77 if (fromIndex > toIndex) 10.60/3.77 throw new IllegalArgumentException(); 10.60/3.77 l = list; 10.60/3.77 offset = fromIndex; 10.60/3.77 size = toIndex - fromIndex; 10.60/3.77 this.modCount = l.modCount; 10.60/3.77 } 10.60/3.77 10.60/3.77 public E set(int index, E element) { 10.60/3.77 rangeCheck(index); 10.60/3.77 checkForComodification(); 10.60/3.77 return l.set(index+offset, element); 10.60/3.77 } 10.60/3.77 10.60/3.77 public E get(int index) { 10.60/3.77 rangeCheck(index); 10.60/3.77 checkForComodification(); 10.60/3.77 return l.get(index+offset); 10.60/3.77 } 10.60/3.77 10.60/3.77 public int size() { 10.60/3.77 checkForComodification(); 10.60/3.77 return size; 10.60/3.77 } 10.60/3.77 10.60/3.77 public void add(int index, E element) { 10.60/3.77 rangeCheckForAdd(index); 10.60/3.77 checkForComodification(); 10.60/3.77 l.add(index+offset, element); 10.60/3.77 this.modCount = l.modCount; 10.60/3.77 size++; 10.60/3.77 } 10.60/3.77 10.60/3.77 public E remove(int index) { 10.60/3.77 rangeCheck(index); 10.60/3.77 checkForComodification(); 10.60/3.77 E result = l.remove(index+offset); 10.60/3.77 this.modCount = l.modCount; 10.60/3.77 size--; 10.60/3.77 return result; 10.60/3.77 } 10.60/3.77 10.60/3.77 protected void removeRange(int fromIndex, int toIndex) { 10.60/3.77 checkForComodification(); 10.60/3.77 l.removeRange(fromIndex+offset, toIndex+offset); 10.60/3.77 this.modCount = l.modCount; 10.60/3.77 size -= (toIndex-fromIndex); 10.60/3.77 } 10.60/3.77 10.60/3.77 public boolean addAll(Collection c) { 10.60/3.77 return addAll(size, c); 10.60/3.77 } 10.60/3.77 10.60/3.77 public boolean addAll(int index, Collection c) { 10.60/3.77 rangeCheckForAdd(index); 10.60/3.77 int cSize = c.size(); 10.60/3.77 if (cSize==0) 10.60/3.77 return false; 10.60/3.77 10.60/3.77 checkForComodification(); 10.60/3.77 l.addAll(offset+index, c); 10.60/3.77 this.modCount = l.modCount; 10.60/3.77 size += cSize; 10.60/3.77 return true; 10.60/3.77 } 10.60/3.77 10.60/3.77 public Iterator iterator() { 10.60/3.77 return listIterator(); 10.60/3.77 } 10.60/3.77 10.60/3.77 public ListIterator listIterator(final int index) { 10.60/3.77 checkForComodification(); 10.60/3.77 rangeCheckForAdd(index); 10.60/3.77 10.60/3.77 return new ListIterator() { 10.60/3.77 private final ListIterator i = l.listIterator(index+offset); 10.60/3.77 10.60/3.77 public boolean hasNext() { 10.60/3.77 return nextIndex() < size; 10.60/3.77 } 10.60/3.77 10.60/3.77 public E next() { 10.60/3.77 if (hasNext()) 10.60/3.77 return i.next(); 10.60/3.77 else 10.60/3.77 throw new NoSuchElementException(); 10.60/3.77 } 10.60/3.77 10.60/3.77 public boolean hasPrevious() { 10.60/3.77 return previousIndex() >= 0; 10.60/3.77 } 10.60/3.77 10.60/3.77 public E previous() { 10.60/3.77 if (hasPrevious()) 10.60/3.77 return i.previous(); 10.60/3.77 else 10.60/3.77 throw new NoSuchElementException(); 10.60/3.77 } 10.60/3.77 10.60/3.77 public int nextIndex() { 10.60/3.77 return i.nextIndex() - offset; 10.60/3.77 } 10.60/3.77 10.60/3.77 public int previousIndex() { 10.60/3.77 return i.previousIndex() - offset; 10.60/3.77 } 10.60/3.77 10.60/3.77 public void remove() { 10.60/3.77 i.remove(); 10.60/3.77 SubList.this.modCount = l.modCount; 10.60/3.77 size--; 10.60/3.77 } 10.60/3.77 10.60/3.77 public void set(E e) { 10.60/3.77 i.set(e); 10.60/3.77 } 10.60/3.77 10.60/3.77 public void add(E e) { 10.60/3.77 i.add(e); 10.60/3.77 SubList.this.modCount = l.modCount; 10.60/3.77 size++; 10.60/3.77 } 10.60/3.77 }; 10.60/3.77 } 10.60/3.77 10.60/3.77 public List subList(int fromIndex, int toIndex) { 10.60/3.77 return new SubList(this, fromIndex, toIndex); 10.60/3.77 } 10.60/3.77 10.60/3.77 private void rangeCheck(int index) { 10.60/3.77 if (index < 0 || index >= size) 10.60/3.77 throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); 10.60/3.77 } 10.60/3.77 10.60/3.77 private void rangeCheckForAdd(int index) { 10.60/3.77 if (index < 0 || index > size) 10.60/3.77 throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); 10.60/3.77 } 10.60/3.77 10.60/3.77 private String outOfBoundsMsg(int index) { 10.60/3.77 return ""; 10.60/3.77 } 10.60/3.77 10.60/3.77 private void checkForComodification() { 10.60/3.77 if (this.modCount != l.modCount) 10.60/3.77 throw new ConcurrentModificationException(); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 class RandomAccessSubList extends SubList implements RandomAccess { 10.60/3.77 RandomAccessSubList(AbstractList list, int fromIndex, int toIndex) { 10.60/3.77 super(list, fromIndex, toIndex); 10.60/3.77 } 10.60/3.77 10.60/3.77 public List subList(int fromIndex, int toIndex) { 10.60/3.77 return new RandomAccessSubList(this, fromIndex, toIndex); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.77 * 10.60/3.77 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.77 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.77 * have any questions. 10.60/3.77 */ 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 /** 10.60/3.77 * This class provides a skeletal implementation of the List 10.60/3.77 * interface to minimize the effort required to implement this interface 10.60/3.77 * backed by a "sequential access" data store (such as a linked list). For 10.60/3.77 * random access data (such as an array), AbstractList should be used 10.60/3.77 * in preference to this class.

10.60/3.77 * 10.60/3.77 * This class is the opposite of the AbstractList class in the sense 10.60/3.77 * that it implements the "random access" methods (get(int index), 10.60/3.77 * set(int index, E element), add(int index, E element) and 10.60/3.77 * remove(int index)) on top of the list's list iterator, instead of 10.60/3.77 * the other way around.

10.60/3.77 * 10.60/3.77 * To implement a list the programmer needs only to extend this class and 10.60/3.77 * provide implementations for the listIterator and size 10.60/3.77 * methods. For an unmodifiable list, the programmer need only implement the 10.60/3.77 * list iterator's hasNext, next, hasPrevious, 10.60/3.77 * previous and index methods.

10.60/3.77 * 10.60/3.77 * For a modifiable list the programmer should additionally implement the list 10.60/3.77 * iterator's set method. For a variable-size list the programmer 10.60/3.77 * should additionally implement the list iterator's remove and 10.60/3.77 * add methods.

10.60/3.77 * 10.60/3.77 * The programmer should generally provide a void (no argument) and collection 10.60/3.77 * constructor, as per the recommendation in the Collection interface 10.60/3.77 * specification.

10.60/3.77 * 10.60/3.77 * This class is a member of the 10.60/3.77 * 10.60/3.77 * Java Collections Framework. 10.60/3.77 * 10.60/3.77 * @author Josh Bloch 10.60/3.77 * @author Neal Gafter 10.60/3.77 * @see Collection 10.60/3.77 * @see List 10.60/3.77 * @see AbstractList 10.60/3.77 * @see AbstractCollection 10.60/3.77 * @since 1.2 10.60/3.77 */ 10.60/3.77 10.60/3.77 public abstract class AbstractSequentialList extends AbstractList { 10.60/3.77 /** 10.60/3.77 * Sole constructor. (For invocation by subclass constructors, typically 10.60/3.77 * implicit.) 10.60/3.77 */ 10.60/3.77 protected AbstractSequentialList() { 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns the element at the specified position in this list. 10.60/3.77 * 10.60/3.77 *

This implementation first gets a list iterator pointing to the 10.60/3.77 * indexed element (with listIterator(index)). Then, it gets 10.60/3.77 * the element using ListIterator.next and returns it. 10.60/3.77 * 10.60/3.77 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.77 */ 10.60/3.77 public E get(int index) { 10.60/3.77 try { 10.60/3.77 return listIterator(index).next(); 10.60/3.77 } catch (NoSuchElementException exc) { 10.60/3.77 throw new IndexOutOfBoundsException(); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Replaces the element at the specified position in this list with the 10.60/3.77 * specified element (optional operation). 10.60/3.77 * 10.60/3.77 *

This implementation first gets a list iterator pointing to the 10.60/3.77 * indexed element (with listIterator(index)). Then, it gets 10.60/3.77 * the current element using ListIterator.next and replaces it 10.60/3.77 * with ListIterator.set. 10.60/3.77 * 10.60/3.77 *

Note that this implementation will throw an 10.60/3.77 * UnsupportedOperationException if the list iterator does not 10.60/3.77 * implement the set operation. 10.60/3.77 * 10.60/3.77 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.77 * @throws ClassCastException {@inheritDoc} 10.60/3.77 * @throws NullPointerException {@inheritDoc} 10.60/3.77 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.77 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.77 */ 10.60/3.77 public E set(int index, E element) { 10.60/3.77 try { 10.60/3.77 ListIterator e = listIterator(index); 10.60/3.77 E oldVal = e.next(); 10.60/3.77 e.set(element); 10.60/3.77 return oldVal; 10.60/3.77 } catch (NoSuchElementException exc) { 10.60/3.77 throw new IndexOutOfBoundsException(); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Inserts the specified element at the specified position in this list 10.60/3.77 * (optional operation). Shifts the element currently at that position 10.60/3.77 * (if any) and any subsequent elements to the right (adds one to their 10.60/3.77 * indices). 10.60/3.77 * 10.60/3.77 *

This implementation first gets a list iterator pointing to the 10.60/3.77 * indexed element (with listIterator(index)). Then, it 10.60/3.77 * inserts the specified element with ListIterator.add. 10.60/3.77 * 10.60/3.77 *

Note that this implementation will throw an 10.60/3.77 * UnsupportedOperationException if the list iterator does not 10.60/3.77 * implement the add operation. 10.60/3.77 * 10.60/3.77 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.77 * @throws ClassCastException {@inheritDoc} 10.60/3.77 * @throws NullPointerException {@inheritDoc} 10.60/3.77 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.77 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.77 */ 10.60/3.77 public void add(int index, E element) { 10.60/3.77 try { 10.60/3.77 listIterator(index).add(element); 10.60/3.77 } catch (NoSuchElementException exc) { 10.60/3.77 throw new IndexOutOfBoundsException(); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes the element at the specified position in this list (optional 10.60/3.77 * operation). Shifts any subsequent elements to the left (subtracts one 10.60/3.77 * from their indices). Returns the element that was removed from the 10.60/3.77 * list. 10.60/3.77 * 10.60/3.77 *

This implementation first gets a list iterator pointing to the 10.60/3.77 * indexed element (with listIterator(index)). Then, it removes 10.60/3.77 * the element with ListIterator.remove. 10.60/3.77 * 10.60/3.77 *

Note that this implementation will throw an 10.60/3.77 * UnsupportedOperationException if the list iterator does not 10.60/3.77 * implement the remove operation. 10.60/3.77 * 10.60/3.77 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.77 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.77 */ 10.60/3.77 public E remove(int index) { 10.60/3.77 try { 10.60/3.77 ListIterator e = listIterator(index); 10.60/3.77 E outCast = e.next(); 10.60/3.77 e.remove(); 10.60/3.77 return outCast; 10.60/3.77 } catch (NoSuchElementException exc) { 10.60/3.77 throw new IndexOutOfBoundsException(); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 // Bulk Operations 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Inserts all of the elements in the specified collection into this 10.60/3.77 * list at the specified position (optional operation). Shifts the 10.60/3.77 * element currently at that position (if any) and any subsequent 10.60/3.77 * elements to the right (increases their indices). The new elements 10.60/3.77 * will appear in this list in the order that they are returned by the 10.60/3.77 * specified collection's iterator. The behavior of this operation is 10.60/3.77 * undefined if the specified collection is modified while the 10.60/3.77 * operation is in progress. (Note that this will occur if the specified 10.60/3.77 * collection is this list, and it's nonempty.) 10.60/3.77 * 10.60/3.77 *

This implementation gets an iterator over the specified collection and 10.60/3.77 * a list iterator over this list pointing to the indexed element (with 10.60/3.77 * listIterator(index)). Then, it iterates over the specified 10.60/3.77 * collection, inserting the elements obtained from the iterator into this 10.60/3.77 * list, one at a time, using ListIterator.add followed by 10.60/3.77 * ListIterator.next (to skip over the added element). 10.60/3.77 * 10.60/3.77 *

Note that this implementation will throw an 10.60/3.77 * UnsupportedOperationException if the list iterator returned by 10.60/3.77 * the listIterator method does not implement the add 10.60/3.77 * operation. 10.60/3.77 * 10.60/3.77 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.77 * @throws ClassCastException {@inheritDoc} 10.60/3.77 * @throws NullPointerException {@inheritDoc} 10.60/3.77 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.77 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.77 */ 10.60/3.77 public boolean addAll(int index, Collection c) { 10.60/3.77 try { 10.60/3.77 boolean modified = false; 10.60/3.77 ListIterator e1 = listIterator(index); 10.60/3.77 Iterator e2 = c.iterator(); 10.60/3.77 while (e2.hasNext()) { 10.60/3.77 e1.add(e2.next()); 10.60/3.77 modified = true; 10.60/3.77 } 10.60/3.77 return modified; 10.60/3.77 } catch (NoSuchElementException exc) { 10.60/3.77 throw new IndexOutOfBoundsException(); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 // Iterators 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns an iterator over the elements in this list (in proper 10.60/3.77 * sequence).

10.60/3.77 * 10.60/3.77 * This implementation merely returns a list iterator over the list. 10.60/3.77 * 10.60/3.77 * @return an iterator over the elements in this list (in proper sequence) 10.60/3.77 */ 10.60/3.77 public Iterator iterator() { 10.60/3.77 return listIterator(); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns a list iterator over the elements in this list (in proper 10.60/3.77 * sequence). 10.60/3.77 * 10.60/3.77 * @param index index of first element to be returned from the list 10.60/3.77 * iterator (by a call to the next method) 10.60/3.77 * @return a list iterator over the elements in this list (in proper 10.60/3.77 * sequence) 10.60/3.77 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.77 */ 10.60/3.77 public abstract ListIterator listIterator(int index); 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.77 * 10.60/3.77 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.77 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.77 * have any questions. 10.60/3.77 */ 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 /** 10.60/3.77 * The root interface in the collection hierarchy. A collection 10.60/3.77 * represents a group of objects, known as its elements. Some 10.60/3.77 * collections allow duplicate elements and others do not. Some are ordered 10.60/3.77 * and others unordered. The JDK does not provide any direct 10.60/3.77 * implementations of this interface: it provides implementations of more 10.60/3.77 * specific subinterfaces like Set and List. This interface 10.60/3.77 * is typically used to pass collections around and manipulate them where 10.60/3.77 * maximum generality is desired. 10.60/3.77 * 10.60/3.77 *

Bags or multisets (unordered collections that may contain 10.60/3.77 * duplicate elements) should implement this interface directly. 10.60/3.77 * 10.60/3.77 *

All general-purpose Collection implementation classes (which 10.60/3.77 * typically implement Collection indirectly through one of its 10.60/3.77 * subinterfaces) should provide two "standard" constructors: a void (no 10.60/3.77 * arguments) constructor, which creates an empty collection, and a 10.60/3.77 * constructor with a single argument of type Collection, which 10.60/3.77 * creates a new collection with the same elements as its argument. In 10.60/3.77 * effect, the latter constructor allows the user to copy any collection, 10.60/3.77 * producing an equivalent collection of the desired implementation type. 10.60/3.77 * There is no way to enforce this convention (as interfaces cannot contain 10.60/3.77 * constructors) but all of the general-purpose Collection 10.60/3.77 * implementations in the Java platform libraries comply. 10.60/3.77 * 10.60/3.77 *

The "destructive" methods contained in this interface, that is, the 10.60/3.77 * methods that modify the collection on which they operate, are specified to 10.60/3.77 * throw UnsupportedOperationException if this collection does not 10.60/3.77 * support the operation. If this is the case, these methods may, but are not 10.60/3.77 * required to, throw an UnsupportedOperationException if the 10.60/3.77 * invocation would have no effect on the collection. For example, invoking 10.60/3.77 * the {@link #addAll(Collection)} method on an unmodifiable collection may, 10.60/3.77 * but is not required to, throw the exception if the collection to be added 10.60/3.77 * is empty. 10.60/3.77 * 10.60/3.77 *

Some collection implementations have restrictions on the elements that 10.60/3.77 * they may contain. For example, some implementations prohibit null elements, 10.60/3.77 * and some have restrictions on the types of their elements. Attempting to 10.60/3.77 * add an ineligible element throws an unchecked exception, typically 10.60/3.77 * NullPointerException or ClassCastException. Attempting 10.60/3.77 * to query the presence of an ineligible element may throw an exception, 10.60/3.77 * or it may simply return false; some implementations will exhibit the former 10.60/3.77 * behavior and some will exhibit the latter. More generally, attempting an 10.60/3.77 * operation on an ineligible element whose completion would not result in 10.60/3.77 * the insertion of an ineligible element into the collection may throw an 10.60/3.77 * exception or it may succeed, at the option of the implementation. 10.60/3.77 * Such exceptions are marked as "optional" in the specification for this 10.60/3.77 * interface. 10.60/3.77 * 10.60/3.77 *

It is up to each collection to determine its own synchronization 10.60/3.77 * policy. In the absence of a stronger guarantee by the 10.60/3.77 * implementation, undefined behavior may result from the invocation 10.60/3.77 * of any method on a collection that is being mutated by another 10.60/3.77 * thread; this includes direct invocations, passing the collection to 10.60/3.77 * a method that might perform invocations, and using an existing 10.60/3.77 * iterator to examine the collection. 10.60/3.77 * 10.60/3.77 *

Many methods in Collections Framework interfaces are defined in 10.60/3.77 * terms of the {@link Object#equals(Object) equals} method. For example, 10.60/3.77 * the specification for the {@link #contains(Object) contains(Object o)} 10.60/3.77 * method says: "returns true if and only if this collection 10.60/3.77 * contains at least one element e such that 10.60/3.77 * (o==null ? e==null : o.equals(e))." This specification should 10.60/3.77 * not be construed to imply that invoking Collection.contains 10.60/3.77 * with a non-null argument o will cause o.equals(e) to be 10.60/3.77 * invoked for any element e. Implementations are free to implement 10.60/3.77 * optimizations whereby the equals invocation is avoided, for 10.60/3.77 * example, by first comparing the hash codes of the two elements. (The 10.60/3.77 * {@link Object#hashCode()} specification guarantees that two objects with 10.60/3.77 * unequal hash codes cannot be equal.) More generally, implementations of 10.60/3.77 * the various Collections Framework interfaces are free to take advantage of 10.60/3.77 * the specified behavior of underlying {@link Object} methods wherever the 10.60/3.77 * implementor deems it appropriate. 10.60/3.77 * 10.60/3.77 *

This interface is a member of the 10.60/3.77 * 10.60/3.77 * Java Collections Framework. 10.60/3.77 * 10.60/3.77 * @author Josh Bloch 10.60/3.77 * @author Neal Gafter 10.60/3.77 * @see Set 10.60/3.77 * @see List 10.60/3.77 * @see Map 10.60/3.77 * @see SortedSet 10.60/3.77 * @see SortedMap 10.60/3.77 * @see HashSet 10.60/3.77 * @see TreeSet 10.60/3.77 * @see ArrayList 10.60/3.77 * @see LinkedList 10.60/3.77 * @see Vector 10.60/3.77 * @see Collections 10.60/3.77 * @see Arrays 10.60/3.77 * @see AbstractCollection 10.60/3.77 * @since 1.2 10.60/3.77 */ 10.60/3.77 10.60/3.77 public interface Collection { 10.60/3.77 // Query Operations 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns the number of elements in this collection. If this collection 10.60/3.77 * contains more than Integer.MAX_VALUE elements, returns 10.60/3.77 * Integer.MAX_VALUE. 10.60/3.77 * 10.60/3.77 * @return the number of elements in this collection 10.60/3.77 */ 10.60/3.77 int size(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns true if this collection contains no elements. 10.60/3.77 * 10.60/3.77 * @return true if this collection contains no elements 10.60/3.77 */ 10.60/3.77 boolean isEmpty(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns true if this collection contains the specified element. 10.60/3.77 * More formally, returns true if and only if this collection 10.60/3.77 * contains at least one element e such that 10.60/3.77 * (o==null ? e==null : o.equals(e)). 10.60/3.77 * 10.60/3.77 * @param o element whose presence in this collection is to be tested 10.60/3.77 * @return true if this collection contains the specified 10.60/3.77 * element 10.60/3.77 * @throws ClassCastException if the type of the specified element 10.60/3.77 * is incompatible with this collection (optional) 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * collection does not permit null elements (optional) 10.60/3.77 */ 10.60/3.77 boolean contains(Object o); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns an iterator over the elements in this collection. There are no 10.60/3.77 * guarantees concerning the order in which the elements are returned 10.60/3.77 * (unless this collection is an instance of some class that provides a 10.60/3.77 * guarantee). 10.60/3.77 * 10.60/3.77 * @return an Iterator over the elements in this collection 10.60/3.77 */ 10.60/3.77 Iterator iterator(); 10.60/3.77 10.60/3.77 // Modification Operations 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Ensures that this collection contains the specified element (optional 10.60/3.77 * operation). Returns true if this collection changed as a 10.60/3.77 * result of the call. (Returns false if this collection does 10.60/3.77 * not permit duplicates and already contains the specified element.)

10.60/3.77 * 10.60/3.77 * Collections that support this operation may place limitations on what 10.60/3.77 * elements may be added to this collection. In particular, some 10.60/3.77 * collections will refuse to add null elements, and others will 10.60/3.77 * impose restrictions on the type of elements that may be added. 10.60/3.77 * Collection classes should clearly specify in their documentation any 10.60/3.77 * restrictions on what elements may be added.

10.60/3.77 * 10.60/3.77 * If a collection refuses to add a particular element for any reason 10.60/3.77 * other than that it already contains the element, it must throw 10.60/3.77 * an exception (rather than returning false). This preserves 10.60/3.77 * the invariant that a collection always contains the specified element 10.60/3.77 * after this call returns. 10.60/3.77 * 10.60/3.77 * @param e element whose presence in this collection is to be ensured 10.60/3.77 * @return true if this collection changed as a result of the 10.60/3.77 * call 10.60/3.77 * @throws UnsupportedOperationException if the add operation 10.60/3.77 * is not supported by this collection 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this collection 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * collection does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the element 10.60/3.77 * prevents it from being added to this collection 10.60/3.77 * @throws IllegalStateException if the element cannot be added at this 10.60/3.77 * time due to insertion restrictions 10.60/3.77 */ 10.60/3.77 boolean add(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes a single instance of the specified element from this 10.60/3.77 * collection, if it is present (optional operation). More formally, 10.60/3.77 * removes an element e such that 10.60/3.77 * (o==null ? e==null : o.equals(e)), if 10.60/3.77 * this collection contains one or more such elements. Returns 10.60/3.77 * true if this collection contained the specified element (or 10.60/3.77 * equivalently, if this collection changed as a result of the call). 10.60/3.77 * 10.60/3.77 * @param o element to be removed from this collection, if present 10.60/3.77 * @return true if an element was removed as a result of this call 10.60/3.77 * @throws ClassCastException if the type of the specified element 10.60/3.77 * is incompatible with this collection (optional) 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * collection does not permit null elements (optional) 10.60/3.77 * @throws UnsupportedOperationException if the remove operation 10.60/3.77 * is not supported by this collection 10.60/3.77 */ 10.60/3.77 boolean remove(Object o); 10.60/3.77 10.60/3.77 10.60/3.77 // Bulk Operations 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns true if this collection contains all of the elements 10.60/3.77 * in the specified collection. 10.60/3.77 * 10.60/3.77 * @param c collection to be checked for containment in this collection 10.60/3.77 * @return true if this collection contains all of the elements 10.60/3.77 * in the specified collection 10.60/3.77 * @throws ClassCastException if the types of one or more elements 10.60/3.77 * in the specified collection are incompatible with this 10.60/3.77 * collection (optional) 10.60/3.77 * @throws NullPointerException if the specified collection contains one 10.60/3.77 * or more null elements and this collection does not permit null 10.60/3.77 * elements (optional), or if the specified collection is null 10.60/3.77 * @see #contains(Object) 10.60/3.77 */ 10.60/3.77 boolean containsAll(Collection c); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Adds all of the elements in the specified collection to this collection 10.60/3.77 * (optional operation). The behavior of this operation is undefined if 10.60/3.77 * the specified collection is modified while the operation is in progress. 10.60/3.77 * (This implies that the behavior of this call is undefined if the 10.60/3.77 * specified collection is this collection, and this collection is 10.60/3.77 * nonempty.) 10.60/3.77 * 10.60/3.77 * @param c collection containing elements to be added to this collection 10.60/3.77 * @return true if this collection changed as a result of the call 10.60/3.77 * @throws UnsupportedOperationException if the addAll operation 10.60/3.77 * is not supported by this collection 10.60/3.77 * @throws ClassCastException if the class of an element of the specified 10.60/3.77 * collection prevents it from being added to this collection 10.60/3.77 * @throws NullPointerException if the specified collection contains a 10.60/3.77 * null element and this collection does not permit null elements, 10.60/3.77 * or if the specified collection is null 10.60/3.77 * @throws IllegalArgumentException if some property of an element of the 10.60/3.77 * specified collection prevents it from being added to this 10.60/3.77 * collection 10.60/3.77 * @throws IllegalStateException if not all the elements can be added at 10.60/3.77 * this time due to insertion restrictions 10.60/3.77 * @see #add(Object) 10.60/3.77 */ 10.60/3.77 boolean addAll(Collection c); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes all of this collection's elements that are also contained in the 10.60/3.77 * specified collection (optional operation). After this call returns, 10.60/3.77 * this collection will contain no elements in common with the specified 10.60/3.77 * collection. 10.60/3.77 * 10.60/3.77 * @param c collection containing elements to be removed from this collection 10.60/3.77 * @return true if this collection changed as a result of the 10.60/3.77 * call 10.60/3.77 * @throws UnsupportedOperationException if the removeAll method 10.60/3.77 * is not supported by this collection 10.60/3.77 * @throws ClassCastException if the types of one or more elements 10.60/3.77 * in this collection are incompatible with the specified 10.60/3.77 * collection (optional) 10.60/3.77 * @throws NullPointerException if this collection contains one or more 10.60/3.77 * null elements and the specified collection does not support 10.60/3.77 * null elements (optional), or if the specified collection is null 10.60/3.77 * @see #remove(Object) 10.60/3.77 * @see #contains(Object) 10.60/3.77 */ 10.60/3.77 boolean removeAll(Collection c); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retains only the elements in this collection that are contained in the 10.60/3.77 * specified collection (optional operation). In other words, removes from 10.60/3.77 * this collection all of its elements that are not contained in the 10.60/3.77 * specified collection. 10.60/3.77 * 10.60/3.77 * @param c collection containing elements to be retained in this collection 10.60/3.77 * @return true if this collection changed as a result of the call 10.60/3.77 * @throws UnsupportedOperationException if the retainAll operation 10.60/3.77 * is not supported by this collection 10.60/3.77 * @throws ClassCastException if the types of one or more elements 10.60/3.77 * in this collection are incompatible with the specified 10.60/3.77 * collection (optional) 10.60/3.77 * @throws NullPointerException if this collection contains one or more 10.60/3.77 * null elements and the specified collection does not permit null 10.60/3.77 * elements (optional), or if the specified collection is null 10.60/3.77 * @see #remove(Object) 10.60/3.77 * @see #contains(Object) 10.60/3.77 */ 10.60/3.77 boolean retainAll(Collection c); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes all of the elements from this collection (optional operation). 10.60/3.77 * The collection will be empty after this method returns. 10.60/3.77 * 10.60/3.77 * @throws UnsupportedOperationException if the clear operation 10.60/3.77 * is not supported by this collection 10.60/3.77 */ 10.60/3.77 void clear(); 10.60/3.77 10.60/3.77 10.60/3.77 // Comparison and hashing 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Compares the specified object with this collection for equality.

10.60/3.77 * 10.60/3.77 * While the Collection interface adds no stipulations to the 10.60/3.77 * general contract for the Object.equals, programmers who 10.60/3.77 * implement the Collection interface "directly" (in other words, 10.60/3.77 * create a class that is a Collection but is not a Set 10.60/3.77 * or a List) must exercise care if they choose to override the 10.60/3.77 * Object.equals. It is not necessary to do so, and the simplest 10.60/3.77 * course of action is to rely on Object's implementation, but 10.60/3.77 * the implementor may wish to implement a "value comparison" in place of 10.60/3.77 * the default "reference comparison." (The List and 10.60/3.77 * Set interfaces mandate such value comparisons.)

10.60/3.77 * 10.60/3.77 * The general contract for the Object.equals method states that 10.60/3.77 * equals must be symmetric (in other words, a.equals(b) if and 10.60/3.77 * only if b.equals(a)). The contracts for List.equals 10.60/3.77 * and Set.equals state that lists are only equal to other lists, 10.60/3.77 * and sets to other sets. Thus, a custom equals method for a 10.60/3.77 * collection class that implements neither the List nor 10.60/3.77 * Set interface must return false when this collection 10.60/3.77 * is compared to any list or set. (By the same logic, it is not possible 10.60/3.77 * to write a class that correctly implements both the Set and 10.60/3.77 * List interfaces.) 10.60/3.77 * 10.60/3.77 * @param o object to be compared for equality with this collection 10.60/3.77 * @return true if the specified object is equal to this 10.60/3.77 * collection 10.60/3.77 * 10.60/3.77 * @see Object#equals(Object) 10.60/3.77 * @see Set#equals(Object) 10.60/3.77 * @see List#equals(Object) 10.60/3.77 */ 10.60/3.77 boolean equals(Object o); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns the hash code value for this collection. While the 10.60/3.77 * Collection interface adds no stipulations to the general 10.60/3.77 * contract for the Object.hashCode method, programmers should 10.60/3.77 * take note that any class that overrides the Object.equals 10.60/3.77 * method must also override the Object.hashCode method in order 10.60/3.77 * to satisfy the general contract for the Object.hashCodemethod. 10.60/3.77 * In particular, c1.equals(c2) implies that 10.60/3.77 * c1.hashCode()==c2.hashCode(). 10.60/3.77 * 10.60/3.77 * @return the hash code value for this collection 10.60/3.77 * 10.60/3.77 * @see Object#hashCode() 10.60/3.77 * @see Object#equals(Object) 10.60/3.77 */ 10.60/3.77 int hashCode(); 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.77 * 10.60/3.77 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.77 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.77 * have any questions. 10.60/3.77 */ 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 /** 10.60/3.77 * This exception may be thrown by methods that have detected concurrent 10.60/3.77 * modification of an object when such modification is not permissible. 10.60/3.77 *

10.60/3.77 * For example, it is not generally permissible for one thread to modify a Collection 10.60/3.77 * while another thread is iterating over it. In general, the results of the 10.60/3.77 * iteration are undefined under these circumstances. Some Iterator 10.60/3.77 * implementations (including those of all the general purpose collection implementations 10.60/3.77 * provided by the JRE) may choose to throw this exception if this behavior is 10.60/3.77 * detected. Iterators that do this are known as fail-fast iterators, 10.60/3.77 * as they fail quickly and cleanly, rather that risking arbitrary, 10.60/3.77 * non-deterministic behavior at an undetermined time in the future. 10.60/3.77 *

10.60/3.77 * Note that this exception does not always indicate that an object has 10.60/3.77 * been concurrently modified by a different thread. If a single 10.60/3.77 * thread issues a sequence of method invocations that violates the 10.60/3.77 * contract of an object, the object may throw this exception. For 10.60/3.77 * example, if a thread modifies a collection directly while it is 10.60/3.77 * iterating over the collection with a fail-fast iterator, the iterator 10.60/3.77 * will throw this exception. 10.60/3.77 * 10.60/3.77 *

Note that fail-fast behavior cannot be guaranteed as it is, generally 10.60/3.77 * speaking, impossible to make any hard guarantees in the presence of 10.60/3.77 * unsynchronized concurrent modification. Fail-fast operations 10.60/3.77 * throw ConcurrentModificationException on a best-effort basis. 10.60/3.77 * Therefore, it would be wrong to write a program that depended on this 10.60/3.77 * exception for its correctness: ConcurrentModificationException 10.60/3.77 * should be used only to detect bugs. 10.60/3.77 * 10.60/3.77 * @author Josh Bloch 10.60/3.77 * @see Collection 10.60/3.77 * @see Iterator 10.60/3.77 * @see ListIterator 10.60/3.77 * @see Vector 10.60/3.77 * @see LinkedList 10.60/3.77 * @see HashSet 10.60/3.77 * @see Hashtable 10.60/3.77 * @see TreeMap 10.60/3.77 * @see AbstractList 10.60/3.77 * @since 1.2 10.60/3.77 */ 10.60/3.77 public class ConcurrentModificationException extends RuntimeException { 10.60/3.77 /** 10.60/3.77 * Constructs a ConcurrentModificationException with no 10.60/3.77 * detail message. 10.60/3.77 */ 10.60/3.77 public ConcurrentModificationException() { 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Constructs a ConcurrentModificationException with the 10.60/3.77 * specified detail message. 10.60/3.77 * 10.60/3.77 * @param message the detail message pertaining to this exception. 10.60/3.77 */ 10.60/3.77 public ConcurrentModificationException(String message) { 10.60/3.77 super(message); 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.77 * 10.60/3.77 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.77 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.77 * have any questions. 10.60/3.77 */ 10.60/3.77 10.60/3.77 /* 10.60/3.77 * This file is available under and governed by the GNU General Public 10.60/3.77 * License version 2 only, as published by the Free Software Foundation. 10.60/3.77 * However, the following notice accompanied the original version of this 10.60/3.77 * file: 10.60/3.77 * 10.60/3.77 * Written by Doug Lea and Josh Bloch with assistance from members of 10.60/3.77 * JCP JSR-166 Expert Group and released to the public domain, as explained 10.60/3.77 * at http://creativecommons.org/licenses/publicdomain 10.60/3.77 */ 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 /** 10.60/3.77 * A linear collection that supports element insertion and removal at 10.60/3.77 * both ends. The name deque is short for "double ended queue" 10.60/3.77 * and is usually pronounced "deck". Most Deque 10.60/3.77 * implementations place no fixed limits on the number of elements 10.60/3.77 * they may contain, but this interface supports capacity-restricted 10.60/3.77 * deques as well as those with no fixed size limit. 10.60/3.77 * 10.60/3.77 *

This interface defines methods to access the elements at both 10.60/3.77 * ends of the deque. Methods are provided to insert, remove, and 10.60/3.77 * examine the element. Each of these methods exists in two forms: 10.60/3.77 * one throws an exception if the operation fails, the other returns a 10.60/3.77 * special value (either null or false, depending on 10.60/3.77 * the operation). The latter form of the insert operation is 10.60/3.77 * designed specifically for use with capacity-restricted 10.60/3.77 * Deque implementations; in most implementations, insert 10.60/3.77 * operations cannot fail. 10.60/3.77 * 10.60/3.77 *

The twelve methods described above are summarized in the 10.60/3.77 * following table: 10.60/3.77 * 10.60/3.77 *

10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 *
First Element (Head) Last Element (Tail)
Throws exceptionSpecial valueThrows exceptionSpecial value
Insert{@link #addFirst addFirst(e)}{@link #offerFirst offerFirst(e)}{@link #addLast addLast(e)}{@link #offerLast offerLast(e)}
Remove{@link #removeFirst removeFirst()}{@link #pollFirst pollFirst()}{@link #removeLast removeLast()}{@link #pollLast pollLast()}
Examine{@link #getFirst getFirst()}{@link #peekFirst peekFirst()}{@link #getLast getLast()}{@link #peekLast peekLast()}
10.60/3.77 * 10.60/3.77 *

This interface extends the {@link Queue} interface. When a deque is 10.60/3.77 * used as a queue, FIFO (First-In-First-Out) behavior results. Elements are 10.60/3.77 * added at the end of the deque and removed from the beginning. The methods 10.60/3.77 * inherited from the Queue interface are precisely equivalent to 10.60/3.77 * Deque methods as indicated in the following table: 10.60/3.77 * 10.60/3.77 *

10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 *
Queue Method Equivalent Deque Method
{@link java.util.Queue#add add(e)}{@link #addLast addLast(e)}
{@link java.util.Queue#offer offer(e)}{@link #offerLast offerLast(e)}
{@link java.util.Queue#remove remove()}{@link #removeFirst removeFirst()}
{@link java.util.Queue#poll poll()}{@link #pollFirst pollFirst()}
{@link java.util.Queue#element element()}{@link #getFirst getFirst()}
{@link java.util.Queue#peek peek()}{@link #peek peekFirst()}
10.60/3.77 * 10.60/3.77 *

Deques can also be used as LIFO (Last-In-First-Out) stacks. This 10.60/3.77 * interface should be used in preference to the legacy {@link Stack} class. 10.60/3.77 * When a deque is used as a stack, elements are pushed and popped from the 10.60/3.77 * beginning of the deque. Stack methods are precisely equivalent to 10.60/3.77 * Deque methods as indicated in the table below: 10.60/3.77 * 10.60/3.77 *

10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 * 10.60/3.77 *
Stack Method Equivalent Deque Method
{@link #push push(e)}{@link #addFirst addFirst(e)}
{@link #pop pop()}{@link #removeFirst removeFirst()}
{@link #peek peek()}{@link #peekFirst peekFirst()}
10.60/3.77 * 10.60/3.77 *

Note that the {@link #peek peek} method works equally well when 10.60/3.77 * a deque is used as a queue or a stack; in either case, elements are 10.60/3.77 * drawn from the beginning of the deque. 10.60/3.77 * 10.60/3.77 *

This interface provides two methods to remove interior 10.60/3.77 * elements, {@link #removeFirstOccurrence removeFirstOccurrence} and 10.60/3.77 * {@link #removeLastOccurrence removeLastOccurrence}. 10.60/3.77 * 10.60/3.77 *

Unlike the {@link List} interface, this interface does not 10.60/3.77 * provide support for indexed access to elements. 10.60/3.77 * 10.60/3.77 *

While Deque implementations are not strictly required 10.60/3.77 * to prohibit the insertion of null elements, they are strongly 10.60/3.77 * encouraged to do so. Users of any Deque implementations 10.60/3.77 * that do allow null elements are strongly encouraged not to 10.60/3.77 * take advantage of the ability to insert nulls. This is so because 10.60/3.77 * null is used as a special return value by various methods 10.60/3.77 * to indicated that the deque is empty. 10.60/3.77 * 10.60/3.77 *

Deque implementations generally do not define 10.60/3.77 * element-based versions of the equals and hashCode 10.60/3.77 * methods, but instead inherit the identity-based versions from class 10.60/3.77 * Object. 10.60/3.77 * 10.60/3.77 *

This interface is a member of the Java Collections 10.60/3.77 * Framework. 10.60/3.77 * 10.60/3.77 * @author Doug Lea 10.60/3.77 * @author Josh Bloch 10.60/3.77 * @since 1.6 10.60/3.77 * @param the type of elements held in this collection 10.60/3.77 */ 10.60/3.77 10.60/3.77 public interface Deque extends Queue { 10.60/3.77 /** 10.60/3.77 * Inserts the specified element at the front of this deque if it is 10.60/3.77 * possible to do so immediately without violating capacity restrictions. 10.60/3.77 * When using a capacity-restricted deque, it is generally preferable to 10.60/3.77 * use method {@link #offerFirst}. 10.60/3.77 * 10.60/3.77 * @param e the element to add 10.60/3.77 * @throws IllegalStateException if the element cannot be added at this 10.60/3.77 * time due to capacity restrictions 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this deque 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the specified 10.60/3.77 * element prevents it from being added to this deque 10.60/3.77 */ 10.60/3.77 void addFirst(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Inserts the specified element at the end of this deque if it is 10.60/3.77 * possible to do so immediately without violating capacity restrictions. 10.60/3.77 * When using a capacity-restricted deque, it is generally preferable to 10.60/3.77 * use method {@link #offerLast}. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #add}. 10.60/3.77 * 10.60/3.77 * @param e the element to add 10.60/3.77 * @throws IllegalStateException if the element cannot be added at this 10.60/3.77 * time due to capacity restrictions 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this deque 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the specified 10.60/3.77 * element prevents it from being added to this deque 10.60/3.77 */ 10.60/3.77 void addLast(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Inserts the specified element at the front of this deque unless it would 10.60/3.77 * violate capacity restrictions. When using a capacity-restricted deque, 10.60/3.77 * this method is generally preferable to the {@link #addFirst} method, 10.60/3.77 * which can fail to insert an element only by throwing an exception. 10.60/3.77 * 10.60/3.77 * @param e the element to add 10.60/3.77 * @return true if the element was added to this deque, else 10.60/3.77 * false 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this deque 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the specified 10.60/3.77 * element prevents it from being added to this deque 10.60/3.77 */ 10.60/3.77 boolean offerFirst(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Inserts the specified element at the end of this deque unless it would 10.60/3.77 * violate capacity restrictions. When using a capacity-restricted deque, 10.60/3.77 * this method is generally preferable to the {@link #addLast} method, 10.60/3.77 * which can fail to insert an element only by throwing an exception. 10.60/3.77 * 10.60/3.77 * @param e the element to add 10.60/3.77 * @return true if the element was added to this deque, else 10.60/3.77 * false 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this deque 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the specified 10.60/3.77 * element prevents it from being added to this deque 10.60/3.77 */ 10.60/3.77 boolean offerLast(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves and removes the first element of this deque. This method 10.60/3.77 * differs from {@link #pollFirst pollFirst} only in that it throws an 10.60/3.77 * exception if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the head of this deque 10.60/3.77 * @throws NoSuchElementException if this deque is empty 10.60/3.77 */ 10.60/3.77 E removeFirst(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves and removes the last element of this deque. This method 10.60/3.77 * differs from {@link #pollLast pollLast} only in that it throws an 10.60/3.77 * exception if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the tail of this deque 10.60/3.77 * @throws NoSuchElementException if this deque is empty 10.60/3.77 */ 10.60/3.77 E removeLast(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves and removes the first element of this deque, 10.60/3.77 * or returns null if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the head of this deque, or null if this deque is empty 10.60/3.77 */ 10.60/3.77 E pollFirst(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves and removes the last element of this deque, 10.60/3.77 * or returns null if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the tail of this deque, or null if this deque is empty 10.60/3.77 */ 10.60/3.77 E pollLast(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves, but does not remove, the first element of this deque. 10.60/3.77 * 10.60/3.77 * This method differs from {@link #peekFirst peekFirst} only in that it 10.60/3.77 * throws an exception if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the head of this deque 10.60/3.77 * @throws NoSuchElementException if this deque is empty 10.60/3.77 */ 10.60/3.77 E getFirst(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves, but does not remove, the last element of this deque. 10.60/3.77 * This method differs from {@link #peekLast peekLast} only in that it 10.60/3.77 * throws an exception if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the tail of this deque 10.60/3.77 * @throws NoSuchElementException if this deque is empty 10.60/3.77 */ 10.60/3.77 E getLast(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves, but does not remove, the first element of this deque, 10.60/3.77 * or returns null if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the head of this deque, or null if this deque is empty 10.60/3.77 */ 10.60/3.77 E peekFirst(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves, but does not remove, the last element of this deque, 10.60/3.77 * or returns null if this deque is empty. 10.60/3.77 * 10.60/3.77 * @return the tail of this deque, or null if this deque is empty 10.60/3.77 */ 10.60/3.77 E peekLast(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes the first occurrence of the specified element from this deque. 10.60/3.77 * If the deque does not contain the element, it is unchanged. 10.60/3.77 * More formally, removes the first element e such that 10.60/3.77 * (o==null ? e==null : o.equals(e)) 10.60/3.77 * (if such an element exists). 10.60/3.77 * Returns true if this deque contained the specified element 10.60/3.77 * (or equivalently, if this deque changed as a result of the call). 10.60/3.77 * 10.60/3.77 * @param o element to be removed from this deque, if present 10.60/3.77 * @return true if an element was removed as a result of this call 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * is incompatible with this deque (optional) 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements (optional) 10.60/3.77 */ 10.60/3.77 boolean removeFirstOccurrence(Object o); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes the last occurrence of the specified element from this deque. 10.60/3.77 * If the deque does not contain the element, it is unchanged. 10.60/3.77 * More formally, removes the last element e such that 10.60/3.77 * (o==null ? e==null : o.equals(e)) 10.60/3.77 * (if such an element exists). 10.60/3.77 * Returns true if this deque contained the specified element 10.60/3.77 * (or equivalently, if this deque changed as a result of the call). 10.60/3.77 * 10.60/3.77 * @param o element to be removed from this deque, if present 10.60/3.77 * @return true if an element was removed as a result of this call 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * is incompatible with this deque (optional) 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements (optional) 10.60/3.77 */ 10.60/3.77 boolean removeLastOccurrence(Object o); 10.60/3.77 10.60/3.77 // *** Queue methods *** 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Inserts the specified element into the queue represented by this deque 10.60/3.77 * (in other words, at the tail of this deque) if it is possible to do so 10.60/3.77 * immediately without violating capacity restrictions, returning 10.60/3.77 * true upon success and throwing an 10.60/3.77 * IllegalStateException if no space is currently available. 10.60/3.77 * When using a capacity-restricted deque, it is generally preferable to 10.60/3.77 * use {@link #offer(Object) offer}. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #addLast}. 10.60/3.77 * 10.60/3.77 * @param e the element to add 10.60/3.77 * @return true (as specified by {@link Collection#add}) 10.60/3.77 * @throws IllegalStateException if the element cannot be added at this 10.60/3.77 * time due to capacity restrictions 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this deque 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the specified 10.60/3.77 * element prevents it from being added to this deque 10.60/3.77 */ 10.60/3.77 boolean add(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Inserts the specified element into the queue represented by this deque 10.60/3.77 * (in other words, at the tail of this deque) if it is possible to do so 10.60/3.77 * immediately without violating capacity restrictions, returning 10.60/3.77 * true upon success and false if no space is currently 10.60/3.77 * available. When using a capacity-restricted deque, this method is 10.60/3.77 * generally preferable to the {@link #add} method, which can fail to 10.60/3.77 * insert an element only by throwing an exception. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #offerLast}. 10.60/3.77 * 10.60/3.77 * @param e the element to add 10.60/3.77 * @return true if the element was added to this deque, else 10.60/3.77 * false 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this deque 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the specified 10.60/3.77 * element prevents it from being added to this deque 10.60/3.77 */ 10.60/3.77 boolean offer(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves and removes the head of the queue represented by this deque 10.60/3.77 * (in other words, the first element of this deque). 10.60/3.77 * This method differs from {@link #poll poll} only in that it throws an 10.60/3.77 * exception if this deque is empty. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #removeFirst()}. 10.60/3.77 * 10.60/3.77 * @return the head of the queue represented by this deque 10.60/3.77 * @throws NoSuchElementException if this deque is empty 10.60/3.77 */ 10.60/3.77 E remove(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves and removes the head of the queue represented by this deque 10.60/3.77 * (in other words, the first element of this deque), or returns 10.60/3.77 * null if this deque is empty. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #pollFirst()}. 10.60/3.77 * 10.60/3.77 * @return the first element of this deque, or null if 10.60/3.77 * this deque is empty 10.60/3.77 */ 10.60/3.77 E poll(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves, but does not remove, the head of the queue represented by 10.60/3.77 * this deque (in other words, the first element of this deque). 10.60/3.77 * This method differs from {@link #peek peek} only in that it throws an 10.60/3.77 * exception if this deque is empty. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #getFirst()}. 10.60/3.77 * 10.60/3.77 * @return the head of the queue represented by this deque 10.60/3.77 * @throws NoSuchElementException if this deque is empty 10.60/3.77 */ 10.60/3.77 E element(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Retrieves, but does not remove, the head of the queue represented by 10.60/3.77 * this deque (in other words, the first element of this deque), or 10.60/3.77 * returns null if this deque is empty. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #peekFirst()}. 10.60/3.77 * 10.60/3.77 * @return the head of the queue represented by this deque, or 10.60/3.77 * null if this deque is empty 10.60/3.77 */ 10.60/3.77 E peek(); 10.60/3.77 10.60/3.77 10.60/3.77 // *** Stack methods *** 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Pushes an element onto the stack represented by this deque (in other 10.60/3.77 * words, at the head of this deque) if it is possible to do so 10.60/3.77 * immediately without violating capacity restrictions, returning 10.60/3.77 * true upon success and throwing an 10.60/3.77 * IllegalStateException if no space is currently available. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #addFirst}. 10.60/3.77 * 10.60/3.77 * @param e the element to push 10.60/3.77 * @throws IllegalStateException if the element cannot be added at this 10.60/3.77 * time due to capacity restrictions 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * prevents it from being added to this deque 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements 10.60/3.77 * @throws IllegalArgumentException if some property of the specified 10.60/3.77 * element prevents it from being added to this deque 10.60/3.77 */ 10.60/3.77 void push(E e); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Pops an element from the stack represented by this deque. In other 10.60/3.77 * words, removes and returns the first element of this deque. 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #removeFirst()}. 10.60/3.77 * 10.60/3.77 * @return the element at the front of this deque (which is the top 10.60/3.77 * of the stack represented by this deque) 10.60/3.77 * @throws NoSuchElementException if this deque is empty 10.60/3.77 */ 10.60/3.77 E pop(); 10.60/3.77 10.60/3.77 10.60/3.77 // *** Collection methods *** 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes the first occurrence of the specified element from this deque. 10.60/3.77 * If the deque does not contain the element, it is unchanged. 10.60/3.77 * More formally, removes the first element e such that 10.60/3.77 * (o==null ? e==null : o.equals(e)) 10.60/3.77 * (if such an element exists). 10.60/3.77 * Returns true if this deque contained the specified element 10.60/3.77 * (or equivalently, if this deque changed as a result of the call). 10.60/3.77 * 10.60/3.77 *

This method is equivalent to {@link #removeFirstOccurrence}. 10.60/3.77 * 10.60/3.77 * @param o element to be removed from this deque, if present 10.60/3.77 * @return true if an element was removed as a result of this call 10.60/3.77 * @throws ClassCastException if the class of the specified element 10.60/3.77 * is incompatible with this deque (optional) 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements (optional) 10.60/3.77 */ 10.60/3.77 boolean remove(Object o); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns true if this deque contains the specified element. 10.60/3.77 * More formally, returns true if and only if this deque contains 10.60/3.77 * at least one element e such that 10.60/3.77 * (o==null ? e==null : o.equals(e)). 10.60/3.77 * 10.60/3.77 * @param o element whose presence in this deque is to be tested 10.60/3.77 * @return true if this deque contains the specified element 10.60/3.77 * @throws ClassCastException if the type of the specified element 10.60/3.77 * is incompatible with this deque (optional) 10.60/3.77 * @throws NullPointerException if the specified element is null and this 10.60/3.77 * deque does not permit null elements (optional) 10.60/3.77 */ 10.60/3.77 boolean contains(Object o); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns the number of elements in this deque. 10.60/3.77 * 10.60/3.77 * @return the number of elements in this deque 10.60/3.77 */ 10.60/3.77 public int size(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns an iterator over the elements in this deque in proper sequence. 10.60/3.77 * The elements will be returned in order from first (head) to last (tail). 10.60/3.77 * 10.60/3.77 * @return an iterator over the elements in this deque in proper sequence 10.60/3.77 */ 10.60/3.77 Iterator iterator(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns an iterator over the elements in this deque in reverse 10.60/3.77 * sequential order. The elements will be returned in order from 10.60/3.77 * last (tail) to first (head). 10.60/3.77 * 10.60/3.77 * @return an iterator over the elements in this deque in reverse 10.60/3.77 * sequence 10.60/3.77 */ 10.60/3.77 Iterator descendingIterator(); 10.60/3.77 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.77 * 10.60/3.77 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.77 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.77 * have any questions. 10.60/3.77 */ 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Thrown to indicate that a method has been passed an illegal or 10.60/3.77 * inappropriate argument. 10.60/3.77 * 10.60/3.77 * @author unascribed 10.60/3.77 * @see java.lang.Thread#setPriority(int) 10.60/3.77 * @since JDK1.0 10.60/3.77 */ 10.60/3.77 public 10.60/3.77 class IllegalArgumentException extends RuntimeException { 10.60/3.77 /** 10.60/3.77 * Constructs an IllegalArgumentException with no 10.60/3.77 * detail message. 10.60/3.77 */ 10.60/3.77 public IllegalArgumentException() { 10.60/3.77 super(); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Constructs an IllegalArgumentException with the 10.60/3.77 * specified detail message. 10.60/3.77 * 10.60/3.77 * @param s the detail message. 10.60/3.77 */ 10.60/3.77 public IllegalArgumentException(String s) { 10.60/3.77 super(s); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Constructs a new exception with the specified detail message and 10.60/3.77 * cause. 10.60/3.77 * 10.60/3.77 *

Note that the detail message associated with cause is 10.60/3.77 * not automatically incorporated in this exception's detail 10.60/3.77 * message. 10.60/3.77 * 10.60/3.77 * @param message the detail message (which is saved for later retrieval 10.60/3.77 * by the {@link Throwable#getMessage()} method). 10.60/3.77 * @param cause the cause (which is saved for later retrieval by the 10.60/3.77 * {@link Throwable#getCause()} method). (A null value 10.60/3.77 * is permitted, and indicates that the cause is nonexistent or 10.60/3.77 * unknown.) 10.60/3.77 * @since 1.5 10.60/3.77 */ 10.60/3.77 public IllegalArgumentException(String message, Throwable cause) { 10.60/3.77 super(message, cause); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Constructs a new exception with the specified cause and a detail 10.60/3.77 * message of (cause==null ? null : cause.toString()) (which 10.60/3.77 * typically contains the class and detail message of cause). 10.60/3.77 * This constructor is useful for exceptions that are little more than 10.60/3.77 * wrappers for other throwables (for example, {@link 10.60/3.77 * java.security.PrivilegedActionException}). 10.60/3.77 * 10.60/3.77 * @param cause the cause (which is saved for later retrieval by the 10.60/3.77 * {@link Throwable#getCause()} method). (A null value is 10.60/3.77 * permitted, and indicates that the cause is nonexistent or 10.60/3.77 * unknown.) 10.60/3.77 * @since 1.5 10.60/3.77 */ 10.60/3.77 public IllegalArgumentException(Throwable cause) { 10.60/3.77 super(cause); 10.60/3.77 } 10.60/3.77 10.60/3.77 private static final long serialVersionUID = -5365630128856068164L; 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.77 * 10.60/3.77 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.77 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.77 * have any questions. 10.60/3.77 */ 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Signals that a method has been invoked at an illegal or 10.60/3.77 * inappropriate time. In other words, the Java environment or 10.60/3.77 * Java application is not in an appropriate state for the requested 10.60/3.77 * operation. 10.60/3.77 * 10.60/3.77 * @author Jonni Kanerva 10.60/3.77 * @since JDK1.1 10.60/3.77 */ 10.60/3.77 public 10.60/3.77 class IllegalStateException extends RuntimeException { 10.60/3.77 /** 10.60/3.77 * Constructs an IllegalStateException with no detail message. 10.60/3.77 * A detail message is a String that describes this particular exception. 10.60/3.77 */ 10.60/3.77 public IllegalStateException() { 10.60/3.77 super(); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Constructs an IllegalStateException with the specified detail 10.60/3.77 * message. A detail message is a String that describes this particular 10.60/3.77 * exception. 10.60/3.77 * 10.60/3.77 * @param s the String that contains a detailed message 10.60/3.77 */ 10.60/3.77 public IllegalStateException(String s) { 10.60/3.77 super(s); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Constructs a new exception with the specified detail message and 10.60/3.77 * cause. 10.60/3.77 * 10.60/3.77 *

Note that the detail message associated with cause is 10.60/3.77 * not automatically incorporated in this exception's detail 10.60/3.77 * message. 10.60/3.77 * 10.60/3.77 * @param message the detail message (which is saved for later retrieval 10.60/3.77 * by the {@link Throwable#getMessage()} method). 10.60/3.77 * @param cause the cause (which is saved for later retrieval by the 10.60/3.77 * {@link Throwable#getCause()} method). (A null value 10.60/3.77 * is permitted, and indicates that the cause is nonexistent or 10.60/3.77 * unknown.) 10.60/3.77 * @since 1.5 10.60/3.77 */ 10.60/3.77 public IllegalStateException(String message, Throwable cause) { 10.60/3.77 super(message, cause); 10.60/3.77 } 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Constructs a new exception with the specified cause and a detail 10.60/3.77 * message of (cause==null ? null : cause.toString()) (which 10.60/3.77 * typically contains the class and detail message of cause). 10.60/3.77 * This constructor is useful for exceptions that are little more than 10.60/3.77 * wrappers for other throwables (for example, {@link 10.60/3.77 * java.security.PrivilegedActionException}). 10.60/3.77 * 10.60/3.77 * @param cause the cause (which is saved for later retrieval by the 10.60/3.77 * {@link Throwable#getCause()} method). (A null value is 10.60/3.77 * permitted, and indicates that the cause is nonexistent or 10.60/3.77 * unknown.) 10.60/3.77 * @since 1.5 10.60/3.77 */ 10.60/3.77 public IllegalStateException(Throwable cause) { 10.60/3.77 super(cause); 10.60/3.77 } 10.60/3.77 10.60/3.77 static final long serialVersionUID = -1848914673093119416L; 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.77 * 10.60/3.77 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.77 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.77 * have any questions. 10.60/3.77 */ 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 /** 10.60/3.77 * An iterator over a collection. {@code Iterator} takes the place of 10.60/3.77 * {@link Enumeration} in the Java Collections Framework. Iterators 10.60/3.77 * differ from enumerations in two ways: 10.60/3.77 * 10.60/3.77 *

10.60/3.77 * 10.60/3.77 *

This interface is a member of the 10.60/3.77 * 10.60/3.77 * Java Collections Framework. 10.60/3.77 * 10.60/3.77 * @author Josh Bloch 10.60/3.77 * @see Collection 10.60/3.77 * @see ListIterator 10.60/3.77 * @see Iterable 10.60/3.77 * @since 1.2 10.60/3.77 */ 10.60/3.77 public interface Iterator { 10.60/3.77 /** 10.60/3.77 * Returns {@code true} if the iteration has more elements. 10.60/3.77 * (In other words, returns {@code true} if {@link #next} would 10.60/3.77 * return an element rather than throwing an exception.) 10.60/3.77 * 10.60/3.77 * @return {@code true} if the iteration has more elements 10.60/3.77 */ 10.60/3.77 boolean hasNext(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Returns the next element in the iteration. 10.60/3.77 * 10.60/3.77 * @return the next element in the iteration 10.60/3.77 * @throws NoSuchElementException if the iteration has no more elements 10.60/3.77 */ 10.60/3.77 E next(); 10.60/3.77 10.60/3.77 /** 10.60/3.77 * Removes from the underlying collection the last element returned 10.60/3.77 * by this iterator (optional operation). This method can be called 10.60/3.77 * only once per call to {@link #next}. The behavior of an iterator 10.60/3.77 * is unspecified if the underlying collection is modified while the 10.60/3.77 * iteration is in progress in any way other than by calling this 10.60/3.77 * method. 10.60/3.77 * 10.60/3.77 * @throws UnsupportedOperationException if the {@code remove} 10.60/3.77 * operation is not supported by this iterator 10.60/3.77 * 10.60/3.77 * @throws IllegalStateException if the {@code next} method has not 10.60/3.77 * yet been called, or the {@code remove} method has already 10.60/3.77 * been called after the last call to the {@code next} 10.60/3.77 * method 10.60/3.77 */ 10.60/3.77 void remove(); 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 package javaUtilEx; 10.60/3.77 10.60/3.77 public class juLinkedListCreate { 10.60/3.77 public static void main(String[] args) { 10.60/3.77 Random.args = args; 10.60/3.77 10.60/3.77 LinkedList l = createList(Random.random()); 10.60/3.77 } 10.60/3.77 10.60/3.77 public static LinkedList createList(int n) { 10.60/3.77 LinkedList l = new LinkedList(); 10.60/3.77 while (n > 0) { 10.60/3.77 l.addFirst(new Content(Random.random())); 10.60/3.77 n--; 10.60/3.77 } 10.60/3.77 return l; 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 final class Content { 10.60/3.77 int val; 10.60/3.77 10.60/3.77 public Content(int v) { 10.60/3.77 this.val = v; 10.60/3.77 } 10.60/3.77 10.60/3.77 public int hashCode() { 10.60/3.77 return val^31; 10.60/3.77 } 10.60/3.77 10.60/3.77 public boolean equals(Object o) { 10.60/3.77 if (o instanceof Content) { 10.60/3.77 return this.val == ((Content) o).val; 10.60/3.77 } 10.60/3.77 return false; 10.60/3.77 } 10.60/3.77 } 10.60/3.77 10.60/3.77 10.60/3.77 /* 10.60/3.77 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.77 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.77 * 10.60/3.77 * This code is free software; you can redistribute it and/or modify it 10.60/3.77 * under the terms of the GNU General Public License version 2 only, as 10.60/3.77 * published by the Free Software Foundation. Sun designates this 10.60/3.77 * particular file as subject to the "Classpath" exception as provided 10.60/3.77 * by Sun in the LICENSE file that accompanied this code. 10.60/3.77 * 10.60/3.77 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.77 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.77 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.77 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.77 * accompanied this code). 10.60/3.77 * 10.60/3.77 * You should have received a copy of the GNU General Public License version 10.60/3.77 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.77 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Linked list implementation of the List interface. Implements all 10.60/3.78 * optional list operations, and permits all elements (including 10.60/3.78 * null). In addition to implementing the List interface, 10.60/3.78 * the LinkedList class provides uniformly named methods to 10.60/3.78 * get, remove and insert an element at the 10.60/3.78 * beginning and end of the list. These operations allow linked lists to be 10.60/3.78 * used as a stack, {@linkplain Queue queue}, or {@linkplain Deque 10.60/3.78 * double-ended queue}.

10.60/3.78 * 10.60/3.78 * The class implements the Deque interface, providing 10.60/3.78 * first-in-first-out queue operations for add, 10.60/3.78 * poll, along with other stack and deque operations.

10.60/3.78 * 10.60/3.78 * All of the operations perform as could be expected for a doubly-linked 10.60/3.78 * list. Operations that index into the list will traverse the list from 10.60/3.78 * the beginning or the end, whichever is closer to the specified index.

10.60/3.78 * 10.60/3.78 *

Note that this implementation is not synchronized. 10.60/3.78 * If multiple threads access a linked list concurrently, and at least 10.60/3.78 * one of the threads modifies the list structurally, it must be 10.60/3.78 * synchronized externally. (A structural modification is any operation 10.60/3.78 * that adds or deletes one or more elements; merely setting the value of 10.60/3.78 * an element is not a structural modification.) This is typically 10.60/3.78 * accomplished by synchronizing on some object that naturally 10.60/3.78 * encapsulates the list. 10.60/3.78 * 10.60/3.78 * If no such object exists, the list should be "wrapped" using the 10.60/3.78 * {@link Collections#synchronizedList Collections.synchronizedList} 10.60/3.78 * method. This is best done at creation time, to prevent accidental 10.60/3.78 * unsynchronized access to the list:

10.60/3.78	 *   List list = Collections.synchronizedList(new LinkedList(...));
10.60/3.78 * 10.60/3.78 *

The iterators returned by this class's iterator and 10.60/3.78 * listIterator methods are fail-fast: if the list is 10.60/3.78 * structurally modified at any time after the iterator is created, in 10.60/3.78 * any way except through the Iterator's own remove or 10.60/3.78 * add methods, the iterator will throw a {@link 10.60/3.78 * ConcurrentModificationException}. Thus, in the face of concurrent 10.60/3.78 * modification, the iterator fails quickly and cleanly, rather than 10.60/3.78 * risking arbitrary, non-deterministic behavior at an undetermined 10.60/3.78 * time in the future. 10.60/3.78 * 10.60/3.78 *

Note that the fail-fast behavior of an iterator cannot be guaranteed 10.60/3.78 * as it is, generally speaking, impossible to make any hard guarantees in the 10.60/3.78 * presence of unsynchronized concurrent modification. Fail-fast iterators 10.60/3.78 * throw ConcurrentModificationException on a best-effort basis. 10.60/3.78 * Therefore, it would be wrong to write a program that depended on this 10.60/3.78 * exception for its correctness: the fail-fast behavior of iterators 10.60/3.78 * should be used only to detect bugs. 10.60/3.78 * 10.60/3.78 *

This class is a member of the 10.60/3.78 * 10.60/3.78 * Java Collections Framework. 10.60/3.78 * 10.60/3.78 * @author Josh Bloch 10.60/3.78 * @see List 10.60/3.78 * @see ArrayList 10.60/3.78 * @see Vector 10.60/3.78 * @since 1.2 10.60/3.78 * @param the type of elements held in this collection 10.60/3.78 */ 10.60/3.78 10.60/3.78 public class LinkedList 10.60/3.78 extends AbstractSequentialList 10.60/3.78 implements List, Deque 10.60/3.78 { 10.60/3.78 private transient Entry header = new Entry(null, null, null); 10.60/3.78 private transient int size = 0; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Constructs an empty list. 10.60/3.78 */ 10.60/3.78 public LinkedList() { 10.60/3.78 header.next = header.previous = header; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Constructs a list containing the elements of the specified 10.60/3.78 * collection, in the order they are returned by the collection's 10.60/3.78 * iterator. 10.60/3.78 * 10.60/3.78 * @param c the collection whose elements are to be placed into this list 10.60/3.78 * @throws NullPointerException if the specified collection is null 10.60/3.78 */ 10.60/3.78 public LinkedList(Collection c) { 10.60/3.78 this(); 10.60/3.78 addAll(c); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the first element in this list. 10.60/3.78 * 10.60/3.78 * @return the first element in this list 10.60/3.78 * @throws NoSuchElementException if this list is empty 10.60/3.78 */ 10.60/3.78 public E getFirst() { 10.60/3.78 if (size==0) 10.60/3.78 throw new NoSuchElementException(); 10.60/3.78 10.60/3.78 return header.next.element; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the last element in this list. 10.60/3.78 * 10.60/3.78 * @return the last element in this list 10.60/3.78 * @throws NoSuchElementException if this list is empty 10.60/3.78 */ 10.60/3.78 public E getLast() { 10.60/3.78 if (size==0) 10.60/3.78 throw new NoSuchElementException(); 10.60/3.78 10.60/3.78 return header.previous.element; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes and returns the first element from this list. 10.60/3.78 * 10.60/3.78 * @return the first element from this list 10.60/3.78 * @throws NoSuchElementException if this list is empty 10.60/3.78 */ 10.60/3.78 public E removeFirst() { 10.60/3.78 return remove(header.next); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes and returns the last element from this list. 10.60/3.78 * 10.60/3.78 * @return the last element from this list 10.60/3.78 * @throws NoSuchElementException if this list is empty 10.60/3.78 */ 10.60/3.78 public E removeLast() { 10.60/3.78 return remove(header.previous); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Inserts the specified element at the beginning of this list. 10.60/3.78 * 10.60/3.78 * @param e the element to add 10.60/3.78 */ 10.60/3.78 public void addFirst(E e) { 10.60/3.78 addBefore(e, header.next); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Appends the specified element to the end of this list. 10.60/3.78 * 10.60/3.78 *

This method is equivalent to {@link #add}. 10.60/3.78 * 10.60/3.78 * @param e the element to add 10.60/3.78 */ 10.60/3.78 public void addLast(E e) { 10.60/3.78 addBefore(e, header); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns true if this list contains the specified element. 10.60/3.78 * More formally, returns true if and only if this list contains 10.60/3.78 * at least one element e such that 10.60/3.78 * (o==null ? e==null : o.equals(e)). 10.60/3.78 * 10.60/3.78 * @param o element whose presence in this list is to be tested 10.60/3.78 * @return true if this list contains the specified element 10.60/3.78 */ 10.60/3.78 public boolean contains(Object o) { 10.60/3.78 return indexOf(o) != -1; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the number of elements in this list. 10.60/3.78 * 10.60/3.78 * @return the number of elements in this list 10.60/3.78 */ 10.60/3.78 public int size() { 10.60/3.78 return size; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Appends the specified element to the end of this list. 10.60/3.78 * 10.60/3.78 *

This method is equivalent to {@link #addLast}. 10.60/3.78 * 10.60/3.78 * @param e element to be appended to this list 10.60/3.78 * @return true (as specified by {@link Collection#add}) 10.60/3.78 */ 10.60/3.78 public boolean add(E e) { 10.60/3.78 addBefore(e, header); 10.60/3.78 return true; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes the first occurrence of the specified element from this list, 10.60/3.78 * if it is present. If this list does not contain the element, it is 10.60/3.78 * unchanged. More formally, removes the element with the lowest index 10.60/3.78 * i such that 10.60/3.78 * (o==null ? get(i)==null : o.equals(get(i))) 10.60/3.78 * (if such an element exists). Returns true if this list 10.60/3.78 * contained the specified element (or equivalently, if this list 10.60/3.78 * changed as a result of the call). 10.60/3.78 * 10.60/3.78 * @param o element to be removed from this list, if present 10.60/3.78 * @return true if this list contained the specified element 10.60/3.78 */ 10.60/3.78 public boolean remove(Object o) { 10.60/3.78 if (o==null) { 10.60/3.78 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.78 if (e.element==null) { 10.60/3.78 remove(e); 10.60/3.78 return true; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 } else { 10.60/3.78 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.78 if (o.equals(e.element)) { 10.60/3.78 remove(e); 10.60/3.78 return true; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 } 10.60/3.78 return false; 10.60/3.78 } 10.60/3.78 /** 10.60/3.78 * Removes all of the elements from this list. 10.60/3.78 */ 10.60/3.78 public void clear() { 10.60/3.78 Entry e = header.next; 10.60/3.78 while (e != header) { 10.60/3.78 Entry next = e.next; 10.60/3.78 e.next = e.previous = null; 10.60/3.78 e.element = null; 10.60/3.78 e = next; 10.60/3.78 } 10.60/3.78 header.next = header.previous = header; 10.60/3.78 size = 0; 10.60/3.78 modCount++; 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 // Positional Access Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the element at the specified position in this list. 10.60/3.78 * 10.60/3.78 * @param index index of the element to return 10.60/3.78 * @return the element at the specified position in this list 10.60/3.78 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.78 */ 10.60/3.78 public E get(int index) { 10.60/3.78 return entry(index).element; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Replaces the element at the specified position in this list with the 10.60/3.78 * specified element. 10.60/3.78 * 10.60/3.78 * @param index index of the element to replace 10.60/3.78 * @param element element to be stored at the specified position 10.60/3.78 * @return the element previously at the specified position 10.60/3.78 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.78 */ 10.60/3.78 public E set(int index, E element) { 10.60/3.78 Entry e = entry(index); 10.60/3.78 E oldVal = e.element; 10.60/3.78 e.element = element; 10.60/3.78 return oldVal; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Inserts the specified element at the specified position in this list. 10.60/3.78 * Shifts the element currently at that position (if any) and any 10.60/3.78 * subsequent elements to the right (adds one to their indices). 10.60/3.78 * 10.60/3.78 * @param index index at which the specified element is to be inserted 10.60/3.78 * @param element element to be inserted 10.60/3.78 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.78 */ 10.60/3.78 public void add(int index, E element) { 10.60/3.78 addBefore(element, (index==size ? header : entry(index))); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes the element at the specified position in this list. Shifts any 10.60/3.78 * subsequent elements to the left (subtracts one from their indices). 10.60/3.78 * Returns the element that was removed from the list. 10.60/3.78 * 10.60/3.78 * @param index the index of the element to be removed 10.60/3.78 * @return the element previously at the specified position 10.60/3.78 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.78 */ 10.60/3.78 public E remove(int index) { 10.60/3.78 return remove(entry(index)); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the indexed entry. 10.60/3.78 */ 10.60/3.78 private Entry entry(int index) { 10.60/3.78 if (index < 0 || index >= size) 10.60/3.78 throw new IndexOutOfBoundsException(); 10.60/3.78 Entry e = header; 10.60/3.78 if (index < (size >> 1)) { 10.60/3.78 for (int i = 0; i <= index; i++) 10.60/3.78 e = e.next; 10.60/3.78 } else { 10.60/3.78 for (int i = size; i > index; i--) 10.60/3.78 e = e.previous; 10.60/3.78 } 10.60/3.78 return e; 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 // Search Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the index of the first occurrence of the specified element 10.60/3.78 * in this list, or -1 if this list does not contain the element. 10.60/3.78 * More formally, returns the lowest index i such that 10.60/3.78 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.78 * or -1 if there is no such index. 10.60/3.78 * 10.60/3.78 * @param o element to search for 10.60/3.78 * @return the index of the first occurrence of the specified element in 10.60/3.78 * this list, or -1 if this list does not contain the element 10.60/3.78 */ 10.60/3.78 public int indexOf(Object o) { 10.60/3.78 int index = 0; 10.60/3.78 if (o==null) { 10.60/3.78 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.78 if (e.element==null) 10.60/3.78 return index; 10.60/3.78 index++; 10.60/3.78 } 10.60/3.78 } else { 10.60/3.78 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.78 if (o.equals(e.element)) 10.60/3.78 return index; 10.60/3.78 index++; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 return -1; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the index of the last occurrence of the specified element 10.60/3.78 * in this list, or -1 if this list does not contain the element. 10.60/3.78 * More formally, returns the highest index i such that 10.60/3.78 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.78 * or -1 if there is no such index. 10.60/3.78 * 10.60/3.78 * @param o element to search for 10.60/3.78 * @return the index of the last occurrence of the specified element in 10.60/3.78 * this list, or -1 if this list does not contain the element 10.60/3.78 */ 10.60/3.78 public int lastIndexOf(Object o) { 10.60/3.78 int index = size; 10.60/3.78 if (o==null) { 10.60/3.78 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.78 index--; 10.60/3.78 if (e.element==null) 10.60/3.78 return index; 10.60/3.78 } 10.60/3.78 } else { 10.60/3.78 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.78 index--; 10.60/3.78 if (o.equals(e.element)) 10.60/3.78 return index; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 return -1; 10.60/3.78 } 10.60/3.78 10.60/3.78 // Queue operations. 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves, but does not remove, the head (first element) of this list. 10.60/3.78 * @return the head of this list, or null if this list is empty 10.60/3.78 * @since 1.5 10.60/3.78 */ 10.60/3.78 public E peek() { 10.60/3.78 if (size==0) 10.60/3.78 return null; 10.60/3.78 return getFirst(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves, but does not remove, the head (first element) of this list. 10.60/3.78 * @return the head of this list 10.60/3.78 * @throws NoSuchElementException if this list is empty 10.60/3.78 * @since 1.5 10.60/3.78 */ 10.60/3.78 public E element() { 10.60/3.78 return getFirst(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves and removes the head (first element) of this list 10.60/3.78 * @return the head of this list, or null if this list is empty 10.60/3.78 * @since 1.5 10.60/3.78 */ 10.60/3.78 public E poll() { 10.60/3.78 if (size==0) 10.60/3.78 return null; 10.60/3.78 return removeFirst(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves and removes the head (first element) of this list. 10.60/3.78 * 10.60/3.78 * @return the head of this list 10.60/3.78 * @throws NoSuchElementException if this list is empty 10.60/3.78 * @since 1.5 10.60/3.78 */ 10.60/3.78 public E remove() { 10.60/3.78 return removeFirst(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Adds the specified element as the tail (last element) of this list. 10.60/3.78 * 10.60/3.78 * @param e the element to add 10.60/3.78 * @return true (as specified by {@link Queue#offer}) 10.60/3.78 * @since 1.5 10.60/3.78 */ 10.60/3.78 public boolean offer(E e) { 10.60/3.78 return add(e); 10.60/3.78 } 10.60/3.78 10.60/3.78 // Deque operations 10.60/3.78 /** 10.60/3.78 * Inserts the specified element at the front of this list. 10.60/3.78 * 10.60/3.78 * @param e the element to insert 10.60/3.78 * @return true (as specified by {@link Deque#offerFirst}) 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public boolean offerFirst(E e) { 10.60/3.78 addFirst(e); 10.60/3.78 return true; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Inserts the specified element at the end of this list. 10.60/3.78 * 10.60/3.78 * @param e the element to insert 10.60/3.78 * @return true (as specified by {@link Deque#offerLast}) 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public boolean offerLast(E e) { 10.60/3.78 addLast(e); 10.60/3.78 return true; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves, but does not remove, the first element of this list, 10.60/3.78 * or returns null if this list is empty. 10.60/3.78 * 10.60/3.78 * @return the first element of this list, or null 10.60/3.78 * if this list is empty 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public E peekFirst() { 10.60/3.78 if (size==0) 10.60/3.78 return null; 10.60/3.78 return getFirst(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves, but does not remove, the last element of this list, 10.60/3.78 * or returns null if this list is empty. 10.60/3.78 * 10.60/3.78 * @return the last element of this list, or null 10.60/3.78 * if this list is empty 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public E peekLast() { 10.60/3.78 if (size==0) 10.60/3.78 return null; 10.60/3.78 return getLast(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves and removes the first element of this list, 10.60/3.78 * or returns null if this list is empty. 10.60/3.78 * 10.60/3.78 * @return the first element of this list, or null if 10.60/3.78 * this list is empty 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public E pollFirst() { 10.60/3.78 if (size==0) 10.60/3.78 return null; 10.60/3.78 return removeFirst(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves and removes the last element of this list, 10.60/3.78 * or returns null if this list is empty. 10.60/3.78 * 10.60/3.78 * @return the last element of this list, or null if 10.60/3.78 * this list is empty 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public E pollLast() { 10.60/3.78 if (size==0) 10.60/3.78 return null; 10.60/3.78 return removeLast(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Pushes an element onto the stack represented by this list. In other 10.60/3.78 * words, inserts the element at the front of this list. 10.60/3.78 * 10.60/3.78 *

This method is equivalent to {@link #addFirst}. 10.60/3.78 * 10.60/3.78 * @param e the element to push 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public void push(E e) { 10.60/3.78 addFirst(e); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Pops an element from the stack represented by this list. In other 10.60/3.78 * words, removes and returns the first element of this list. 10.60/3.78 * 10.60/3.78 *

This method is equivalent to {@link #removeFirst()}. 10.60/3.78 * 10.60/3.78 * @return the element at the front of this list (which is the top 10.60/3.78 * of the stack represented by this list) 10.60/3.78 * @throws NoSuchElementException if this list is empty 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public E pop() { 10.60/3.78 return removeFirst(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes the first occurrence of the specified element in this 10.60/3.78 * list (when traversing the list from head to tail). If the list 10.60/3.78 * does not contain the element, it is unchanged. 10.60/3.78 * 10.60/3.78 * @param o element to be removed from this list, if present 10.60/3.78 * @return true if the list contained the specified element 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public boolean removeFirstOccurrence(Object o) { 10.60/3.78 return remove(o); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes the last occurrence of the specified element in this 10.60/3.78 * list (when traversing the list from head to tail). If the list 10.60/3.78 * does not contain the element, it is unchanged. 10.60/3.78 * 10.60/3.78 * @param o element to be removed from this list, if present 10.60/3.78 * @return true if the list contained the specified element 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public boolean removeLastOccurrence(Object o) { 10.60/3.78 if (o==null) { 10.60/3.78 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.78 if (e.element==null) { 10.60/3.78 remove(e); 10.60/3.78 return true; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 } else { 10.60/3.78 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.78 if (o.equals(e.element)) { 10.60/3.78 remove(e); 10.60/3.78 return true; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 } 10.60/3.78 return false; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns a list-iterator of the elements in this list (in proper 10.60/3.78 * sequence), starting at the specified position in the list. 10.60/3.78 * Obeys the general contract of List.listIterator(int).

10.60/3.78 * 10.60/3.78 * The list-iterator is fail-fast: if the list is structurally 10.60/3.78 * modified at any time after the Iterator is created, in any way except 10.60/3.78 * through the list-iterator's own remove or add 10.60/3.78 * methods, the list-iterator will throw a 10.60/3.78 * ConcurrentModificationException. Thus, in the face of 10.60/3.78 * concurrent modification, the iterator fails quickly and cleanly, rather 10.60/3.78 * than risking arbitrary, non-deterministic behavior at an undetermined 10.60/3.78 * time in the future. 10.60/3.78 * 10.60/3.78 * @param index index of the first element to be returned from the 10.60/3.78 * list-iterator (by a call to next) 10.60/3.78 * @return a ListIterator of the elements in this list (in proper 10.60/3.78 * sequence), starting at the specified position in the list 10.60/3.78 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.78 * @see List#listIterator(int) 10.60/3.78 */ 10.60/3.78 public ListIterator listIterator(int index) { 10.60/3.78 return new ListItr(index); 10.60/3.78 } 10.60/3.78 10.60/3.78 private class ListItr implements ListIterator { 10.60/3.78 private Entry lastReturned = header; 10.60/3.78 private Entry next; 10.60/3.78 private int nextIndex; 10.60/3.78 private int expectedModCount = modCount; 10.60/3.78 10.60/3.78 ListItr(int index) { 10.60/3.78 if (index < 0 || index > size) 10.60/3.78 throw new IndexOutOfBoundsException(); 10.60/3.78 if (index < (size >> 1)) { 10.60/3.78 next = header.next; 10.60/3.78 for (nextIndex=0; nextIndexindex; nextIndex--) 10.60/3.78 next = next.previous; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 10.60/3.78 public boolean hasNext() { 10.60/3.78 return nextIndex != size; 10.60/3.78 } 10.60/3.78 10.60/3.78 public E next() { 10.60/3.78 checkForComodification(); 10.60/3.78 if (nextIndex == size) 10.60/3.78 throw new NoSuchElementException(); 10.60/3.78 10.60/3.78 lastReturned = next; 10.60/3.78 next = next.next; 10.60/3.78 nextIndex++; 10.60/3.78 return lastReturned.element; 10.60/3.78 } 10.60/3.78 10.60/3.78 public boolean hasPrevious() { 10.60/3.78 return nextIndex != 0; 10.60/3.78 } 10.60/3.78 10.60/3.78 public E previous() { 10.60/3.78 if (nextIndex == 0) 10.60/3.78 throw new NoSuchElementException(); 10.60/3.78 10.60/3.78 lastReturned = next = next.previous; 10.60/3.78 nextIndex--; 10.60/3.78 checkForComodification(); 10.60/3.78 return lastReturned.element; 10.60/3.78 } 10.60/3.78 10.60/3.78 public int nextIndex() { 10.60/3.78 return nextIndex; 10.60/3.78 } 10.60/3.78 10.60/3.78 public int previousIndex() { 10.60/3.78 return nextIndex-1; 10.60/3.78 } 10.60/3.78 10.60/3.78 public void remove() { 10.60/3.78 checkForComodification(); 10.60/3.78 Entry lastNext = lastReturned.next; 10.60/3.78 try { 10.60/3.78 LinkedList.this.remove(lastReturned); 10.60/3.78 } catch (NoSuchElementException e) { 10.60/3.78 throw new IllegalStateException(); 10.60/3.78 } 10.60/3.78 if (next==lastReturned) 10.60/3.78 next = lastNext; 10.60/3.78 else 10.60/3.78 nextIndex--; 10.60/3.78 lastReturned = header; 10.60/3.78 expectedModCount++; 10.60/3.78 } 10.60/3.78 10.60/3.78 public void set(E e) { 10.60/3.78 if (lastReturned == header) 10.60/3.78 throw new IllegalStateException(); 10.60/3.78 checkForComodification(); 10.60/3.78 lastReturned.element = e; 10.60/3.78 } 10.60/3.78 10.60/3.78 public void add(E e) { 10.60/3.78 checkForComodification(); 10.60/3.78 lastReturned = header; 10.60/3.78 addBefore(e, next); 10.60/3.78 nextIndex++; 10.60/3.78 expectedModCount++; 10.60/3.78 } 10.60/3.78 10.60/3.78 final void checkForComodification() { 10.60/3.78 if (modCount != expectedModCount) 10.60/3.78 throw new ConcurrentModificationException(); 10.60/3.78 } 10.60/3.78 } 10.60/3.78 10.60/3.78 private static class Entry { 10.60/3.78 E element; 10.60/3.78 Entry next; 10.60/3.78 Entry previous; 10.60/3.78 10.60/3.78 Entry(E element, Entry next, Entry previous) { 10.60/3.78 this.element = element; 10.60/3.78 this.next = next; 10.60/3.78 this.previous = previous; 10.60/3.78 } 10.60/3.78 } 10.60/3.78 10.60/3.78 private Entry addBefore(E e, Entry entry) { 10.60/3.78 Entry newEntry = new Entry(e, entry, entry.previous); 10.60/3.78 newEntry.previous.next = newEntry; 10.60/3.78 newEntry.next.previous = newEntry; 10.60/3.78 size++; 10.60/3.78 modCount++; 10.60/3.78 return newEntry; 10.60/3.78 } 10.60/3.78 10.60/3.78 private E remove(Entry e) { 10.60/3.78 if (e == header) 10.60/3.78 throw new NoSuchElementException(); 10.60/3.78 10.60/3.78 E result = e.element; 10.60/3.78 e.previous.next = e.next; 10.60/3.78 e.next.previous = e.previous; 10.60/3.78 e.next = e.previous = null; 10.60/3.78 e.element = null; 10.60/3.78 size--; 10.60/3.78 modCount++; 10.60/3.78 return result; 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * @since 1.6 10.60/3.78 */ 10.60/3.78 public Iterator descendingIterator() { 10.60/3.78 return new DescendingIterator(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** Adapter to provide descending iterators via ListItr.previous */ 10.60/3.78 private class DescendingIterator implements Iterator { 10.60/3.78 final ListItr itr = new ListItr(size()); 10.60/3.78 public boolean hasNext() { 10.60/3.78 return itr.hasPrevious(); 10.60/3.78 } 10.60/3.78 public E next() { 10.60/3.78 return itr.previous(); 10.60/3.78 } 10.60/3.78 public void remove() { 10.60/3.78 itr.remove(); 10.60/3.78 } 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns an array containing all of the elements in this list 10.60/3.78 * in proper sequence (from first to last element). 10.60/3.78 * 10.60/3.78 *

The returned array will be "safe" in that no references to it are 10.60/3.78 * maintained by this list. (In other words, this method must allocate 10.60/3.78 * a new array). The caller is thus free to modify the returned array. 10.60/3.78 * 10.60/3.78 *

This method acts as bridge between array-based and collection-based 10.60/3.78 * APIs. 10.60/3.78 * 10.60/3.78 * @return an array containing all of the elements in this list 10.60/3.78 * in proper sequence 10.60/3.78 */ 10.60/3.78 public Object[] toArray() { 10.60/3.78 Object[] result = new Object[size]; 10.60/3.78 int i = 0; 10.60/3.78 for (Entry e = header.next; e != header; e = e.next) 10.60/3.78 result[i++] = e.element; 10.60/3.78 return result; 10.60/3.78 } 10.60/3.78 10.60/3.78 private static final long serialVersionUID = 876323262645176354L; 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 /* 10.60/3.78 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.78 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.78 * 10.60/3.78 * This code is free software; you can redistribute it and/or modify it 10.60/3.78 * under the terms of the GNU General Public License version 2 only, as 10.60/3.78 * published by the Free Software Foundation. Sun designates this 10.60/3.78 * particular file as subject to the "Classpath" exception as provided 10.60/3.78 * by Sun in the LICENSE file that accompanied this code. 10.60/3.78 * 10.60/3.78 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.78 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.78 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.78 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.78 * accompanied this code). 10.60/3.78 * 10.60/3.78 * You should have received a copy of the GNU General Public License version 10.60/3.78 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.78 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * An iterator for lists that allows the programmer 10.60/3.78 * to traverse the list in either direction, modify 10.60/3.78 * the list during iteration, and obtain the iterator's 10.60/3.78 * current position in the list. A {@code ListIterator} 10.60/3.78 * has no current element; its cursor position always 10.60/3.78 * lies between the element that would be returned by a call 10.60/3.78 * to {@code previous()} and the element that would be 10.60/3.78 * returned by a call to {@code next()}. 10.60/3.78 * An iterator for a list of length {@code n} has {@code n+1} possible 10.60/3.78 * cursor positions, as illustrated by the carets ({@code ^}) below: 10.60/3.78 *

10.60/3.78	 *                      Element(0)   Element(1)   Element(2)   ... Element(n-1)
10.60/3.78	 * cursor positions:  ^            ^            ^            ^                  ^
10.60/3.78	 * 
10.60/3.78 * Note that the {@link #remove} and {@link #set(Object)} methods are 10.60/3.78 * not defined in terms of the cursor position; they are defined to 10.60/3.78 * operate on the last element returned by a call to {@link #next} or 10.60/3.78 * {@link #previous()}. 10.60/3.78 * 10.60/3.78 *

This interface is a member of the 10.60/3.78 * 10.60/3.78 * Java Collections Framework. 10.60/3.78 * 10.60/3.78 * @author Josh Bloch 10.60/3.78 * @see Collection 10.60/3.78 * @see List 10.60/3.78 * @see Iterator 10.60/3.78 * @see Enumeration 10.60/3.78 * @see List#listIterator() 10.60/3.78 * @since 1.2 10.60/3.78 */ 10.60/3.78 public interface ListIterator extends Iterator { 10.60/3.78 // Query Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns {@code true} if this list iterator has more elements when 10.60/3.78 * traversing the list in the forward direction. (In other words, 10.60/3.78 * returns {@code true} if {@link #next} would return an element rather 10.60/3.78 * than throwing an exception.) 10.60/3.78 * 10.60/3.78 * @return {@code true} if the list iterator has more elements when 10.60/3.78 * traversing the list in the forward direction 10.60/3.78 */ 10.60/3.78 boolean hasNext(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the next element in the list and advances the cursor position. 10.60/3.78 * This method may be called repeatedly to iterate through the list, 10.60/3.78 * or intermixed with calls to {@link #previous} to go back and forth. 10.60/3.78 * (Note that alternating calls to {@code next} and {@code previous} 10.60/3.78 * will return the same element repeatedly.) 10.60/3.78 * 10.60/3.78 * @return the next element in the list 10.60/3.78 * @throws NoSuchElementException if the iteration has no next element 10.60/3.78 */ 10.60/3.78 E next(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns {@code true} if this list iterator has more elements when 10.60/3.78 * traversing the list in the reverse direction. (In other words, 10.60/3.78 * returns {@code true} if {@link #previous} would return an element 10.60/3.78 * rather than throwing an exception.) 10.60/3.78 * 10.60/3.78 * @return {@code true} if the list iterator has more elements when 10.60/3.78 * traversing the list in the reverse direction 10.60/3.78 */ 10.60/3.78 boolean hasPrevious(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the previous element in the list and moves the cursor 10.60/3.78 * position backwards. This method may be called repeatedly to 10.60/3.78 * iterate through the list backwards, or intermixed with calls to 10.60/3.78 * {@link #next} to go back and forth. (Note that alternating calls 10.60/3.78 * to {@code next} and {@code previous} will return the same 10.60/3.78 * element repeatedly.) 10.60/3.78 * 10.60/3.78 * @return the previous element in the list 10.60/3.78 * @throws NoSuchElementException if the iteration has no previous 10.60/3.78 * element 10.60/3.78 */ 10.60/3.78 E previous(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the index of the element that would be returned by a 10.60/3.78 * subsequent call to {@link #next}. (Returns list size if the list 10.60/3.78 * iterator is at the end of the list.) 10.60/3.78 * 10.60/3.78 * @return the index of the element that would be returned by a 10.60/3.78 * subsequent call to {@code next}, or list size if the list 10.60/3.78 * iterator is at the end of the list 10.60/3.78 */ 10.60/3.78 int nextIndex(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the index of the element that would be returned by a 10.60/3.78 * subsequent call to {@link #previous}. (Returns -1 if the list 10.60/3.78 * iterator is at the beginning of the list.) 10.60/3.78 * 10.60/3.78 * @return the index of the element that would be returned by a 10.60/3.78 * subsequent call to {@code previous}, or -1 if the list 10.60/3.78 * iterator is at the beginning of the list 10.60/3.78 */ 10.60/3.78 int previousIndex(); 10.60/3.78 10.60/3.78 10.60/3.78 // Modification Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes from the list the last element that was returned by {@link 10.60/3.78 * #next} or {@link #previous} (optional operation). This call can 10.60/3.78 * only be made once per call to {@code next} or {@code previous}. 10.60/3.78 * It can be made only if {@link #add} has not been 10.60/3.78 * called after the last call to {@code next} or {@code previous}. 10.60/3.78 * 10.60/3.78 * @throws UnsupportedOperationException if the {@code remove} 10.60/3.78 * operation is not supported by this list iterator 10.60/3.78 * @throws IllegalStateException if neither {@code next} nor 10.60/3.78 * {@code previous} have been called, or {@code remove} or 10.60/3.78 * {@code add} have been called after the last call to 10.60/3.78 * {@code next} or {@code previous} 10.60/3.78 */ 10.60/3.78 void remove(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Replaces the last element returned by {@link #next} or 10.60/3.78 * {@link #previous} with the specified element (optional operation). 10.60/3.78 * This call can be made only if neither {@link #remove} nor {@link 10.60/3.78 * #add} have been called after the last call to {@code next} or 10.60/3.78 * {@code previous}. 10.60/3.78 * 10.60/3.78 * @param e the element with which to replace the last element returned by 10.60/3.78 * {@code next} or {@code previous} 10.60/3.78 * @throws UnsupportedOperationException if the {@code set} operation 10.60/3.78 * is not supported by this list iterator 10.60/3.78 * @throws ClassCastException if the class of the specified element 10.60/3.78 * prevents it from being added to this list 10.60/3.78 * @throws IllegalArgumentException if some aspect of the specified 10.60/3.78 * element prevents it from being added to this list 10.60/3.78 * @throws IllegalStateException if neither {@code next} nor 10.60/3.78 * {@code previous} have been called, or {@code remove} or 10.60/3.78 * {@code add} have been called after the last call to 10.60/3.78 * {@code next} or {@code previous} 10.60/3.78 */ 10.60/3.78 void set(E e); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Inserts the specified element into the list (optional operation). 10.60/3.78 * The element is inserted immediately before the next element that 10.60/3.78 * would be returned by {@link #next}, if any, and after the next 10.60/3.78 * element that would be returned by {@link #previous}, if any. (If the 10.60/3.78 * list contains no elements, the new element becomes the sole element 10.60/3.78 * on the list.) The new element is inserted before the implicit 10.60/3.78 * cursor: a subsequent call to {@code next} would be unaffected, and a 10.60/3.78 * subsequent call to {@code previous} would return the new element. 10.60/3.78 * (This call increases by one the value that would be returned by a 10.60/3.78 * call to {@code nextIndex} or {@code previousIndex}.) 10.60/3.78 * 10.60/3.78 * @param e the element to insert 10.60/3.78 * @throws UnsupportedOperationException if the {@code add} method is 10.60/3.78 * not supported by this list iterator 10.60/3.78 * @throws ClassCastException if the class of the specified element 10.60/3.78 * prevents it from being added to this list 10.60/3.78 * @throws IllegalArgumentException if some aspect of this element 10.60/3.78 * prevents it from being added to this list 10.60/3.78 */ 10.60/3.78 void add(E e); 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 /* 10.60/3.78 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.78 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.78 * 10.60/3.78 * This code is free software; you can redistribute it and/or modify it 10.60/3.78 * under the terms of the GNU General Public License version 2 only, as 10.60/3.78 * published by the Free Software Foundation. Sun designates this 10.60/3.78 * particular file as subject to the "Classpath" exception as provided 10.60/3.78 * by Sun in the LICENSE file that accompanied this code. 10.60/3.78 * 10.60/3.78 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.78 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.78 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.78 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.78 * accompanied this code). 10.60/3.78 * 10.60/3.78 * You should have received a copy of the GNU General Public License version 10.60/3.78 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.78 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * An ordered collection (also known as a sequence). The user of this 10.60/3.78 * interface has precise control over where in the list each element is 10.60/3.78 * inserted. The user can access elements by their integer index (position in 10.60/3.78 * the list), and search for elements in the list.

10.60/3.78 * 10.60/3.78 * Unlike sets, lists typically allow duplicate elements. More formally, 10.60/3.78 * lists typically allow pairs of elements e1 and e2 10.60/3.78 * such that e1.equals(e2), and they typically allow multiple 10.60/3.78 * null elements if they allow null elements at all. It is not inconceivable 10.60/3.78 * that someone might wish to implement a list that prohibits duplicates, by 10.60/3.78 * throwing runtime exceptions when the user attempts to insert them, but we 10.60/3.78 * expect this usage to be rare.

10.60/3.78 * 10.60/3.78 * The List interface places additional stipulations, beyond those 10.60/3.78 * specified in the Collection interface, on the contracts of the 10.60/3.78 * iterator, add, remove, equals, and 10.60/3.78 * hashCode methods. Declarations for other inherited methods are 10.60/3.78 * also included here for convenience.

10.60/3.78 * 10.60/3.78 * The List interface provides four methods for positional (indexed) 10.60/3.78 * access to list elements. Lists (like Java arrays) are zero based. Note 10.60/3.78 * that these operations may execute in time proportional to the index value 10.60/3.78 * for some implementations (the LinkedList class, for 10.60/3.78 * example). Thus, iterating over the elements in a list is typically 10.60/3.78 * preferable to indexing through it if the caller does not know the 10.60/3.78 * implementation.

10.60/3.78 * 10.60/3.78 * The List interface provides a special iterator, called a 10.60/3.78 * ListIterator, that allows element insertion and replacement, and 10.60/3.78 * bidirectional access in addition to the normal operations that the 10.60/3.78 * Iterator interface provides. A method is provided to obtain a 10.60/3.78 * list iterator that starts at a specified position in the list.

10.60/3.78 * 10.60/3.78 * The List interface provides two methods to search for a specified 10.60/3.78 * object. From a performance standpoint, these methods should be used with 10.60/3.78 * caution. In many implementations they will perform costly linear 10.60/3.78 * searches.

10.60/3.78 * 10.60/3.78 * The List interface provides two methods to efficiently insert and 10.60/3.78 * remove multiple elements at an arbitrary point in the list.

10.60/3.78 * 10.60/3.78 * Note: While it is permissible for lists to contain themselves as elements, 10.60/3.78 * extreme caution is advised: the equals and hashCode 10.60/3.78 * methods are no longer well defined on such a list. 10.60/3.78 * 10.60/3.78 *

Some list implementations have restrictions on the elements that 10.60/3.78 * they may contain. For example, some implementations prohibit null elements, 10.60/3.78 * and some have restrictions on the types of their elements. Attempting to 10.60/3.78 * add an ineligible element throws an unchecked exception, typically 10.60/3.78 * NullPointerException or ClassCastException. Attempting 10.60/3.78 * to query the presence of an ineligible element may throw an exception, 10.60/3.78 * or it may simply return false; some implementations will exhibit the former 10.60/3.78 * behavior and some will exhibit the latter. More generally, attempting an 10.60/3.78 * operation on an ineligible element whose completion would not result in 10.60/3.78 * the insertion of an ineligible element into the list may throw an 10.60/3.78 * exception or it may succeed, at the option of the implementation. 10.60/3.78 * Such exceptions are marked as "optional" in the specification for this 10.60/3.78 * interface. 10.60/3.78 * 10.60/3.78 *

This interface is a member of the 10.60/3.78 * 10.60/3.78 * Java Collections Framework. 10.60/3.78 * 10.60/3.78 * @author Josh Bloch 10.60/3.78 * @author Neal Gafter 10.60/3.78 * @see Collection 10.60/3.78 * @see Set 10.60/3.78 * @see ArrayList 10.60/3.78 * @see LinkedList 10.60/3.78 * @see Vector 10.60/3.78 * @see Arrays#asList(Object[]) 10.60/3.78 * @see Collections#nCopies(int, Object) 10.60/3.78 * @see Collections#EMPTY_LIST 10.60/3.78 * @see AbstractList 10.60/3.78 * @see AbstractSequentialList 10.60/3.78 * @since 1.2 10.60/3.78 */ 10.60/3.78 10.60/3.78 public interface List extends Collection { 10.60/3.78 // Query Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the number of elements in this list. If this list contains 10.60/3.78 * more than Integer.MAX_VALUE elements, returns 10.60/3.78 * Integer.MAX_VALUE. 10.60/3.78 * 10.60/3.78 * @return the number of elements in this list 10.60/3.78 */ 10.60/3.78 int size(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns true if this list contains no elements. 10.60/3.78 * 10.60/3.78 * @return true if this list contains no elements 10.60/3.78 */ 10.60/3.78 boolean isEmpty(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns true if this list contains the specified element. 10.60/3.78 * More formally, returns true if and only if this list contains 10.60/3.78 * at least one element e such that 10.60/3.78 * (o==null ? e==null : o.equals(e)). 10.60/3.78 * 10.60/3.78 * @param o element whose presence in this list is to be tested 10.60/3.78 * @return true if this list contains the specified element 10.60/3.78 * @throws ClassCastException if the type of the specified element 10.60/3.78 * is incompatible with this list (optional) 10.60/3.78 * @throws NullPointerException if the specified element is null and this 10.60/3.78 * list does not permit null elements (optional) 10.60/3.78 */ 10.60/3.78 boolean contains(Object o); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns an iterator over the elements in this list in proper sequence. 10.60/3.78 * 10.60/3.78 * @return an iterator over the elements in this list in proper sequence 10.60/3.78 */ 10.60/3.78 Iterator iterator(); 10.60/3.78 10.60/3.78 // Modification Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Appends the specified element to the end of this list (optional 10.60/3.78 * operation). 10.60/3.78 * 10.60/3.78 *

Lists that support this operation may place limitations on what 10.60/3.78 * elements may be added to this list. In particular, some 10.60/3.78 * lists will refuse to add null elements, and others will impose 10.60/3.78 * restrictions on the type of elements that may be added. List 10.60/3.78 * classes should clearly specify in their documentation any restrictions 10.60/3.78 * on what elements may be added. 10.60/3.78 * 10.60/3.78 * @param e element to be appended to this list 10.60/3.78 * @return true (as specified by {@link Collection#add}) 10.60/3.78 * @throws UnsupportedOperationException if the add operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws ClassCastException if the class of the specified element 10.60/3.78 * prevents it from being added to this list 10.60/3.78 * @throws NullPointerException if the specified element is null and this 10.60/3.78 * list does not permit null elements 10.60/3.78 * @throws IllegalArgumentException if some property of this element 10.60/3.78 * prevents it from being added to this list 10.60/3.78 */ 10.60/3.78 boolean add(E e); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes the first occurrence of the specified element from this list, 10.60/3.78 * if it is present (optional operation). If this list does not contain 10.60/3.78 * the element, it is unchanged. More formally, removes the element with 10.60/3.78 * the lowest index i such that 10.60/3.78 * (o==null ? get(i)==null : o.equals(get(i))) 10.60/3.78 * (if such an element exists). Returns true if this list 10.60/3.78 * contained the specified element (or equivalently, if this list changed 10.60/3.78 * as a result of the call). 10.60/3.78 * 10.60/3.78 * @param o element to be removed from this list, if present 10.60/3.78 * @return true if this list contained the specified element 10.60/3.78 * @throws ClassCastException if the type of the specified element 10.60/3.78 * is incompatible with this list (optional) 10.60/3.78 * @throws NullPointerException if the specified element is null and this 10.60/3.78 * list does not permit null elements (optional) 10.60/3.78 * @throws UnsupportedOperationException if the remove operation 10.60/3.78 * is not supported by this list 10.60/3.78 */ 10.60/3.78 boolean remove(Object o); 10.60/3.78 10.60/3.78 10.60/3.78 // Bulk Modification Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns true if this list contains all of the elements of the 10.60/3.78 * specified collection. 10.60/3.78 * 10.60/3.78 * @param c collection to be checked for containment in this list 10.60/3.78 * @return true if this list contains all of the elements of the 10.60/3.78 * specified collection 10.60/3.78 * @throws ClassCastException if the types of one or more elements 10.60/3.78 * in the specified collection are incompatible with this 10.60/3.78 * list (optional) 10.60/3.78 * @throws NullPointerException if the specified collection contains one 10.60/3.78 * or more null elements and this list does not permit null 10.60/3.78 * elements (optional), or if the specified collection is null 10.60/3.78 * @see #contains(Object) 10.60/3.78 */ 10.60/3.78 boolean containsAll(Collection c); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Appends all of the elements in the specified collection to the end of 10.60/3.78 * this list, in the order that they are returned by the specified 10.60/3.78 * collection's iterator (optional operation). The behavior of this 10.60/3.78 * operation is undefined if the specified collection is modified while 10.60/3.78 * the operation is in progress. (Note that this will occur if the 10.60/3.78 * specified collection is this list, and it's nonempty.) 10.60/3.78 * 10.60/3.78 * @param c collection containing elements to be added to this list 10.60/3.78 * @return true if this list changed as a result of the call 10.60/3.78 * @throws UnsupportedOperationException if the addAll operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws ClassCastException if the class of an element of the specified 10.60/3.78 * collection prevents it from being added to this list 10.60/3.78 * @throws NullPointerException if the specified collection contains one 10.60/3.78 * or more null elements and this list does not permit null 10.60/3.78 * elements, or if the specified collection is null 10.60/3.78 * @throws IllegalArgumentException if some property of an element of the 10.60/3.78 * specified collection prevents it from being added to this list 10.60/3.78 * @see #add(Object) 10.60/3.78 */ 10.60/3.78 boolean addAll(Collection c); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Inserts all of the elements in the specified collection into this 10.60/3.78 * list at the specified position (optional operation). Shifts the 10.60/3.78 * element currently at that position (if any) and any subsequent 10.60/3.78 * elements to the right (increases their indices). The new elements 10.60/3.78 * will appear in this list in the order that they are returned by the 10.60/3.78 * specified collection's iterator. The behavior of this operation is 10.60/3.78 * undefined if the specified collection is modified while the 10.60/3.78 * operation is in progress. (Note that this will occur if the specified 10.60/3.78 * collection is this list, and it's nonempty.) 10.60/3.78 * 10.60/3.78 * @param index index at which to insert the first element from the 10.60/3.78 * specified collection 10.60/3.78 * @param c collection containing elements to be added to this list 10.60/3.78 * @return true if this list changed as a result of the call 10.60/3.78 * @throws UnsupportedOperationException if the addAll operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws ClassCastException if the class of an element of the specified 10.60/3.78 * collection prevents it from being added to this list 10.60/3.78 * @throws NullPointerException if the specified collection contains one 10.60/3.78 * or more null elements and this list does not permit null 10.60/3.78 * elements, or if the specified collection is null 10.60/3.78 * @throws IllegalArgumentException if some property of an element of the 10.60/3.78 * specified collection prevents it from being added to this list 10.60/3.78 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.78 * (index < 0 || index > size()) 10.60/3.78 */ 10.60/3.78 boolean addAll(int index, Collection c); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes from this list all of its elements that are contained in the 10.60/3.78 * specified collection (optional operation). 10.60/3.78 * 10.60/3.78 * @param c collection containing elements to be removed from this list 10.60/3.78 * @return true if this list changed as a result of the call 10.60/3.78 * @throws UnsupportedOperationException if the removeAll operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws ClassCastException if the class of an element of this list 10.60/3.78 * is incompatible with the specified collection (optional) 10.60/3.78 * @throws NullPointerException if this list contains a null element and the 10.60/3.78 * specified collection does not permit null elements (optional), 10.60/3.78 * or if the specified collection is null 10.60/3.78 * @see #remove(Object) 10.60/3.78 * @see #contains(Object) 10.60/3.78 */ 10.60/3.78 boolean removeAll(Collection c); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retains only the elements in this list that are contained in the 10.60/3.78 * specified collection (optional operation). In other words, removes 10.60/3.78 * from this list all of its elements that are not contained in the 10.60/3.78 * specified collection. 10.60/3.78 * 10.60/3.78 * @param c collection containing elements to be retained in this list 10.60/3.78 * @return true if this list changed as a result of the call 10.60/3.78 * @throws UnsupportedOperationException if the retainAll operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws ClassCastException if the class of an element of this list 10.60/3.78 * is incompatible with the specified collection (optional) 10.60/3.78 * @throws NullPointerException if this list contains a null element and the 10.60/3.78 * specified collection does not permit null elements (optional), 10.60/3.78 * or if the specified collection is null 10.60/3.78 * @see #remove(Object) 10.60/3.78 * @see #contains(Object) 10.60/3.78 */ 10.60/3.78 boolean retainAll(Collection c); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes all of the elements from this list (optional operation). 10.60/3.78 * The list will be empty after this call returns. 10.60/3.78 * 10.60/3.78 * @throws UnsupportedOperationException if the clear operation 10.60/3.78 * is not supported by this list 10.60/3.78 */ 10.60/3.78 void clear(); 10.60/3.78 10.60/3.78 10.60/3.78 // Comparison and hashing 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Compares the specified object with this list for equality. Returns 10.60/3.78 * true if and only if the specified object is also a list, both 10.60/3.78 * lists have the same size, and all corresponding pairs of elements in 10.60/3.78 * the two lists are equal. (Two elements e1 and 10.60/3.78 * e2 are equal if (e1==null ? e2==null : 10.60/3.78 * e1.equals(e2)).) In other words, two lists are defined to be 10.60/3.78 * equal if they contain the same elements in the same order. This 10.60/3.78 * definition ensures that the equals method works properly across 10.60/3.78 * different implementations of the List interface. 10.60/3.78 * 10.60/3.78 * @param o the object to be compared for equality with this list 10.60/3.78 * @return true if the specified object is equal to this list 10.60/3.78 */ 10.60/3.78 boolean equals(Object o); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the hash code value for this list. The hash code of a list 10.60/3.78 * is defined to be the result of the following calculation: 10.60/3.78 *

10.60/3.78	     *  int hashCode = 1;
10.60/3.78	     *  for (E e : list)
10.60/3.78	     *      hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
10.60/3.78	     * 
10.60/3.78 * This ensures that list1.equals(list2) implies that 10.60/3.78 * list1.hashCode()==list2.hashCode() for any two lists, 10.60/3.78 * list1 and list2, as required by the general 10.60/3.78 * contract of {@link Object#hashCode}. 10.60/3.78 * 10.60/3.78 * @return the hash code value for this list 10.60/3.78 * @see Object#equals(Object) 10.60/3.78 * @see #equals(Object) 10.60/3.78 */ 10.60/3.78 int hashCode(); 10.60/3.78 10.60/3.78 10.60/3.78 // Positional Access Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the element at the specified position in this list. 10.60/3.78 * 10.60/3.78 * @param index index of the element to return 10.60/3.78 * @return the element at the specified position in this list 10.60/3.78 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.78 * (index < 0 || index >= size()) 10.60/3.78 */ 10.60/3.78 E get(int index); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Replaces the element at the specified position in this list with the 10.60/3.78 * specified element (optional operation). 10.60/3.78 * 10.60/3.78 * @param index index of the element to replace 10.60/3.78 * @param element element to be stored at the specified position 10.60/3.78 * @return the element previously at the specified position 10.60/3.78 * @throws UnsupportedOperationException if the set operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws ClassCastException if the class of the specified element 10.60/3.78 * prevents it from being added to this list 10.60/3.78 * @throws NullPointerException if the specified element is null and 10.60/3.78 * this list does not permit null elements 10.60/3.78 * @throws IllegalArgumentException if some property of the specified 10.60/3.78 * element prevents it from being added to this list 10.60/3.78 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.78 * (index < 0 || index >= size()) 10.60/3.78 */ 10.60/3.78 E set(int index, E element); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Inserts the specified element at the specified position in this list 10.60/3.78 * (optional operation). Shifts the element currently at that position 10.60/3.78 * (if any) and any subsequent elements to the right (adds one to their 10.60/3.78 * indices). 10.60/3.78 * 10.60/3.78 * @param index index at which the specified element is to be inserted 10.60/3.78 * @param element element to be inserted 10.60/3.78 * @throws UnsupportedOperationException if the add operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws ClassCastException if the class of the specified element 10.60/3.78 * prevents it from being added to this list 10.60/3.78 * @throws NullPointerException if the specified element is null and 10.60/3.78 * this list does not permit null elements 10.60/3.78 * @throws IllegalArgumentException if some property of the specified 10.60/3.78 * element prevents it from being added to this list 10.60/3.78 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.78 * (index < 0 || index > size()) 10.60/3.78 */ 10.60/3.78 void add(int index, E element); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Removes the element at the specified position in this list (optional 10.60/3.78 * operation). Shifts any subsequent elements to the left (subtracts one 10.60/3.78 * from their indices). Returns the element that was removed from the 10.60/3.78 * list. 10.60/3.78 * 10.60/3.78 * @param index the index of the element to be removed 10.60/3.78 * @return the element previously at the specified position 10.60/3.78 * @throws UnsupportedOperationException if the remove operation 10.60/3.78 * is not supported by this list 10.60/3.78 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.78 * (index < 0 || index >= size()) 10.60/3.78 */ 10.60/3.78 E remove(int index); 10.60/3.78 10.60/3.78 10.60/3.78 // Search Operations 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the index of the first occurrence of the specified element 10.60/3.78 * in this list, or -1 if this list does not contain the element. 10.60/3.78 * More formally, returns the lowest index i such that 10.60/3.78 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.78 * or -1 if there is no such index. 10.60/3.78 * 10.60/3.78 * @param o element to search for 10.60/3.78 * @return the index of the first occurrence of the specified element in 10.60/3.78 * this list, or -1 if this list does not contain the element 10.60/3.78 * @throws ClassCastException if the type of the specified element 10.60/3.78 * is incompatible with this list (optional) 10.60/3.78 * @throws NullPointerException if the specified element is null and this 10.60/3.78 * list does not permit null elements (optional) 10.60/3.78 */ 10.60/3.78 int indexOf(Object o); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns the index of the last occurrence of the specified element 10.60/3.78 * in this list, or -1 if this list does not contain the element. 10.60/3.78 * More formally, returns the highest index i such that 10.60/3.78 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.78 * or -1 if there is no such index. 10.60/3.78 * 10.60/3.78 * @param o element to search for 10.60/3.78 * @return the index of the last occurrence of the specified element in 10.60/3.78 * this list, or -1 if this list does not contain the element 10.60/3.78 * @throws ClassCastException if the type of the specified element 10.60/3.78 * is incompatible with this list (optional) 10.60/3.78 * @throws NullPointerException if the specified element is null and this 10.60/3.78 * list does not permit null elements (optional) 10.60/3.78 */ 10.60/3.78 int lastIndexOf(Object o); 10.60/3.78 10.60/3.78 10.60/3.78 // List Iterators 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns a list iterator over the elements in this list (in proper 10.60/3.78 * sequence). 10.60/3.78 * 10.60/3.78 * @return a list iterator over the elements in this list (in proper 10.60/3.78 * sequence) 10.60/3.78 */ 10.60/3.78 ListIterator listIterator(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns a list iterator over the elements in this list (in proper 10.60/3.78 * sequence), starting at the specified position in the list. 10.60/3.78 * The specified index indicates the first element that would be 10.60/3.78 * returned by an initial call to {@link ListIterator#next next}. 10.60/3.78 * An initial call to {@link ListIterator#previous previous} would 10.60/3.78 * return the element with the specified index minus one. 10.60/3.78 * 10.60/3.78 * @param index index of the first element to be returned from the 10.60/3.78 * list iterator (by a call to {@link ListIterator#next next}) 10.60/3.78 * @return a list iterator over the elements in this list (in proper 10.60/3.78 * sequence), starting at the specified position in the list 10.60/3.78 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.78 * ({@code index < 0 || index > size()}) 10.60/3.78 */ 10.60/3.78 ListIterator listIterator(int index); 10.60/3.78 10.60/3.78 // View 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Returns a view of the portion of this list between the specified 10.60/3.78 * fromIndex, inclusive, and toIndex, exclusive. (If 10.60/3.78 * fromIndex and toIndex are equal, the returned list is 10.60/3.78 * empty.) The returned list is backed by this list, so non-structural 10.60/3.78 * changes in the returned list are reflected in this list, and vice-versa. 10.60/3.78 * The returned list supports all of the optional list operations supported 10.60/3.78 * by this list.

10.60/3.78 * 10.60/3.78 * This method eliminates the need for explicit range operations (of 10.60/3.78 * the sort that commonly exist for arrays). Any operation that expects 10.60/3.78 * a list can be used as a range operation by passing a subList view 10.60/3.78 * instead of a whole list. For example, the following idiom 10.60/3.78 * removes a range of elements from a list: 10.60/3.78 *

10.60/3.78	     *      list.subList(from, to).clear();
10.60/3.78	     * 
10.60/3.78 * Similar idioms may be constructed for indexOf and 10.60/3.78 * lastIndexOf, and all of the algorithms in the 10.60/3.78 * Collections class can be applied to a subList.

10.60/3.78 * 10.60/3.78 * The semantics of the list returned by this method become undefined if 10.60/3.78 * the backing list (i.e., this list) is structurally modified in 10.60/3.78 * any way other than via the returned list. (Structural modifications are 10.60/3.78 * those that change the size of this list, or otherwise perturb it in such 10.60/3.78 * a fashion that iterations in progress may yield incorrect results.) 10.60/3.78 * 10.60/3.78 * @param fromIndex low endpoint (inclusive) of the subList 10.60/3.78 * @param toIndex high endpoint (exclusive) of the subList 10.60/3.78 * @return a view of the specified range within this list 10.60/3.78 * @throws IndexOutOfBoundsException for an illegal endpoint index value 10.60/3.78 * (fromIndex < 0 || toIndex > size || 10.60/3.78 * fromIndex > toIndex) 10.60/3.78 */ 10.60/3.78 List subList(int fromIndex, int toIndex); 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 /* 10.60/3.78 * Copyright 1994-1998 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.78 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.78 * 10.60/3.78 * This code is free software; you can redistribute it and/or modify it 10.60/3.78 * under the terms of the GNU General Public License version 2 only, as 10.60/3.78 * published by the Free Software Foundation. Sun designates this 10.60/3.78 * particular file as subject to the "Classpath" exception as provided 10.60/3.78 * by Sun in the LICENSE file that accompanied this code. 10.60/3.78 * 10.60/3.78 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.78 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.78 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.78 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.78 * accompanied this code). 10.60/3.78 * 10.60/3.78 * You should have received a copy of the GNU General Public License version 10.60/3.78 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.78 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Thrown by the nextElement method of an 10.60/3.78 * Enumeration to indicate that there are no more 10.60/3.78 * elements in the enumeration. 10.60/3.78 * 10.60/3.78 * @author unascribed 10.60/3.78 * @see java.util.Enumeration 10.60/3.78 * @see java.util.Enumeration#nextElement() 10.60/3.78 * @since JDK1.0 10.60/3.78 */ 10.60/3.78 public 10.60/3.78 class NoSuchElementException extends RuntimeException { 10.60/3.78 /** 10.60/3.78 * Constructs a NoSuchElementException with null 10.60/3.78 * as its error message string. 10.60/3.78 */ 10.60/3.78 public NoSuchElementException() { 10.60/3.78 super(); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Constructs a NoSuchElementException, saving a reference 10.60/3.78 * to the error message string s for later retrieval by the 10.60/3.78 * getMessage method. 10.60/3.78 * 10.60/3.78 * @param s the detail message. 10.60/3.78 */ 10.60/3.78 public NoSuchElementException(String s) { 10.60/3.78 super(s); 10.60/3.78 } 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 /* 10.60/3.78 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.78 * 10.60/3.78 * This code is free software; you can redistribute it and/or modify it 10.60/3.78 * under the terms of the GNU General Public License version 2 only, as 10.60/3.78 * published by the Free Software Foundation. Sun designates this 10.60/3.78 * particular file as subject to the "Classpath" exception as provided 10.60/3.78 * by Sun in the LICENSE file that accompanied this code. 10.60/3.78 * 10.60/3.78 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.78 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.78 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.78 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.78 * accompanied this code). 10.60/3.78 * 10.60/3.78 * You should have received a copy of the GNU General Public License version 10.60/3.78 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.78 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 /* 10.60/3.78 * This file is available under and governed by the GNU General Public 10.60/3.78 * License version 2 only, as published by the Free Software Foundation. 10.60/3.78 * However, the following notice accompanied the original version of this 10.60/3.78 * file: 10.60/3.78 * 10.60/3.78 * Written by Doug Lea with assistance from members of JCP JSR-166 10.60/3.78 * Expert Group and released to the public domain, as explained at 10.60/3.78 * http://creativecommons.org/licenses/publicdomain 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * A collection designed for holding elements prior to processing. 10.60/3.78 * Besides basic {@link java.util.Collection Collection} operations, 10.60/3.78 * queues provide additional insertion, extraction, and inspection 10.60/3.78 * operations. Each of these methods exists in two forms: one throws 10.60/3.78 * an exception if the operation fails, the other returns a special 10.60/3.78 * value (either null or false, depending on the 10.60/3.78 * operation). The latter form of the insert operation is designed 10.60/3.78 * specifically for use with capacity-restricted Queue 10.60/3.78 * implementations; in most implementations, insert operations cannot 10.60/3.78 * fail. 10.60/3.78 * 10.60/3.78 *

10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 * 10.60/3.78 *
Throws exceptionReturns special value
Insert{@link #add add(e)}{@link #offer offer(e)}
Remove{@link #remove remove()}{@link #poll poll()}
Examine{@link #element element()}{@link #peek peek()}
10.60/3.78 * 10.60/3.78 *

Queues typically, but do not necessarily, order elements in a 10.60/3.78 * FIFO (first-in-first-out) manner. Among the exceptions are 10.60/3.78 * priority queues, which order elements according to a supplied 10.60/3.78 * comparator, or the elements' natural ordering, and LIFO queues (or 10.60/3.78 * stacks) which order the elements LIFO (last-in-first-out). 10.60/3.78 * Whatever the ordering used, the head of the queue is that 10.60/3.78 * element which would be removed by a call to {@link #remove() } or 10.60/3.78 * {@link #poll()}. In a FIFO queue, all new elements are inserted at 10.60/3.78 * the tail of the queue. Other kinds of queues may use 10.60/3.78 * different placement rules. Every Queue implementation 10.60/3.78 * must specify its ordering properties. 10.60/3.78 * 10.60/3.78 *

The {@link #offer offer} method inserts an element if possible, 10.60/3.78 * otherwise returning false. This differs from the {@link 10.60/3.78 * java.util.Collection#add Collection.add} method, which can fail to 10.60/3.78 * add an element only by throwing an unchecked exception. The 10.60/3.78 * offer method is designed for use when failure is a normal, 10.60/3.78 * rather than exceptional occurrence, for example, in fixed-capacity 10.60/3.78 * (or "bounded") queues. 10.60/3.78 * 10.60/3.78 *

The {@link #remove()} and {@link #poll()} methods remove and 10.60/3.78 * return the head of the queue. 10.60/3.78 * Exactly which element is removed from the queue is a 10.60/3.78 * function of the queue's ordering policy, which differs from 10.60/3.78 * implementation to implementation. The remove() and 10.60/3.78 * poll() methods differ only in their behavior when the 10.60/3.78 * queue is empty: the remove() method throws an exception, 10.60/3.78 * while the poll() method returns null. 10.60/3.78 * 10.60/3.78 *

The {@link #element()} and {@link #peek()} methods return, but do 10.60/3.78 * not remove, the head of the queue. 10.60/3.78 * 10.60/3.78 *

The Queue interface does not define the blocking queue 10.60/3.78 * methods, which are common in concurrent programming. These methods, 10.60/3.78 * which wait for elements to appear or for space to become available, are 10.60/3.78 * defined in the {@link java.util.concurrent.BlockingQueue} interface, which 10.60/3.78 * extends this interface. 10.60/3.78 * 10.60/3.78 *

Queue implementations generally do not allow insertion 10.60/3.78 * of null elements, although some implementations, such as 10.60/3.78 * {@link LinkedList}, do not prohibit insertion of null. 10.60/3.78 * Even in the implementations that permit it, null should 10.60/3.78 * not be inserted into a Queue, as null is also 10.60/3.78 * used as a special return value by the poll method to 10.60/3.78 * indicate that the queue contains no elements. 10.60/3.78 * 10.60/3.78 *

Queue implementations generally do not define 10.60/3.78 * element-based versions of methods equals and 10.60/3.78 * hashCode but instead inherit the identity based versions 10.60/3.78 * from class Object, because element-based equality is not 10.60/3.78 * always well-defined for queues with the same elements but different 10.60/3.78 * ordering properties. 10.60/3.78 * 10.60/3.78 * 10.60/3.78 *

This interface is a member of the 10.60/3.78 * 10.60/3.78 * Java Collections Framework. 10.60/3.78 * 10.60/3.78 * @see java.util.Collection 10.60/3.78 * @see LinkedList 10.60/3.78 * @see PriorityQueue 10.60/3.78 * @see java.util.concurrent.LinkedBlockingQueue 10.60/3.78 * @see java.util.concurrent.BlockingQueue 10.60/3.78 * @see java.util.concurrent.ArrayBlockingQueue 10.60/3.78 * @see java.util.concurrent.LinkedBlockingQueue 10.60/3.78 * @see java.util.concurrent.PriorityBlockingQueue 10.60/3.78 * @since 1.5 10.60/3.78 * @author Doug Lea 10.60/3.78 * @param the type of elements held in this collection 10.60/3.78 */ 10.60/3.78 public interface Queue extends Collection { 10.60/3.78 /** 10.60/3.78 * Inserts the specified element into this queue if it is possible to do so 10.60/3.78 * immediately without violating capacity restrictions, returning 10.60/3.78 * true upon success and throwing an IllegalStateException 10.60/3.78 * if no space is currently available. 10.60/3.78 * 10.60/3.78 * @param e the element to add 10.60/3.78 * @return true (as specified by {@link Collection#add}) 10.60/3.78 * @throws IllegalStateException if the element cannot be added at this 10.60/3.78 * time due to capacity restrictions 10.60/3.78 * @throws ClassCastException if the class of the specified element 10.60/3.78 * prevents it from being added to this queue 10.60/3.78 * @throws NullPointerException if the specified element is null and 10.60/3.78 * this queue does not permit null elements 10.60/3.78 * @throws IllegalArgumentException if some property of this element 10.60/3.78 * prevents it from being added to this queue 10.60/3.78 */ 10.60/3.78 boolean add(E e); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Inserts the specified element into this queue if it is possible to do 10.60/3.78 * so immediately without violating capacity restrictions. 10.60/3.78 * When using a capacity-restricted queue, this method is generally 10.60/3.78 * preferable to {@link #add}, which can fail to insert an element only 10.60/3.78 * by throwing an exception. 10.60/3.78 * 10.60/3.78 * @param e the element to add 10.60/3.78 * @return true if the element was added to this queue, else 10.60/3.78 * false 10.60/3.78 * @throws ClassCastException if the class of the specified element 10.60/3.78 * prevents it from being added to this queue 10.60/3.78 * @throws NullPointerException if the specified element is null and 10.60/3.78 * this queue does not permit null elements 10.60/3.78 * @throws IllegalArgumentException if some property of this element 10.60/3.78 * prevents it from being added to this queue 10.60/3.78 */ 10.60/3.78 boolean offer(E e); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves and removes the head of this queue. This method differs 10.60/3.78 * from {@link #poll poll} only in that it throws an exception if this 10.60/3.78 * queue is empty. 10.60/3.78 * 10.60/3.78 * @return the head of this queue 10.60/3.78 * @throws NoSuchElementException if this queue is empty 10.60/3.78 */ 10.60/3.78 E remove(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves and removes the head of this queue, 10.60/3.78 * or returns null if this queue is empty. 10.60/3.78 * 10.60/3.78 * @return the head of this queue, or null if this queue is empty 10.60/3.78 */ 10.60/3.78 E poll(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves, but does not remove, the head of this queue. This method 10.60/3.78 * differs from {@link #peek peek} only in that it throws an exception 10.60/3.78 * if this queue is empty. 10.60/3.78 * 10.60/3.78 * @return the head of this queue 10.60/3.78 * @throws NoSuchElementException if this queue is empty 10.60/3.78 */ 10.60/3.78 E element(); 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Retrieves, but does not remove, the head of this queue, 10.60/3.78 * or returns null if this queue is empty. 10.60/3.78 * 10.60/3.78 * @return the head of this queue, or null if this queue is empty 10.60/3.78 */ 10.60/3.78 E peek(); 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 /* 10.60/3.78 * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.78 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.78 * 10.60/3.78 * This code is free software; you can redistribute it and/or modify it 10.60/3.78 * under the terms of the GNU General Public License version 2 only, as 10.60/3.78 * published by the Free Software Foundation. Sun designates this 10.60/3.78 * particular file as subject to the "Classpath" exception as provided 10.60/3.78 * by Sun in the LICENSE file that accompanied this code. 10.60/3.78 * 10.60/3.78 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.78 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.78 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.78 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.78 * accompanied this code). 10.60/3.78 * 10.60/3.78 * You should have received a copy of the GNU General Public License version 10.60/3.78 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.78 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Marker interface used by List implementations to indicate that 10.60/3.78 * they support fast (generally constant time) random access. The primary 10.60/3.78 * purpose of this interface is to allow generic algorithms to alter their 10.60/3.78 * behavior to provide good performance when applied to either random or 10.60/3.78 * sequential access lists. 10.60/3.78 * 10.60/3.78 *

The best algorithms for manipulating random access lists (such as 10.60/3.78 * ArrayList) can produce quadratic behavior when applied to 10.60/3.78 * sequential access lists (such as LinkedList). Generic list 10.60/3.78 * algorithms are encouraged to check whether the given list is an 10.60/3.78 * instanceof this interface before applying an algorithm that would 10.60/3.78 * provide poor performance if it were applied to a sequential access list, 10.60/3.78 * and to alter their behavior if necessary to guarantee acceptable 10.60/3.78 * performance. 10.60/3.78 * 10.60/3.78 *

It is recognized that the distinction between random and sequential 10.60/3.78 * access is often fuzzy. For example, some List implementations 10.60/3.78 * provide asymptotically linear access times if they get huge, but constant 10.60/3.78 * access times in practice. Such a List implementation 10.60/3.78 * should generally implement this interface. As a rule of thumb, a 10.60/3.78 * List implementation should implement this interface if, 10.60/3.78 * for typical instances of the class, this loop: 10.60/3.78 *

10.60/3.78	 *     for (int i=0, n=list.size(); i < n; i++)
10.60/3.78	 *         list.get(i);
10.60/3.78	 * 
10.60/3.78 * runs faster than this loop: 10.60/3.78 *
10.60/3.78	 *     for (Iterator i=list.iterator(); i.hasNext(); )
10.60/3.78	 *         i.next();
10.60/3.78	 * 
10.60/3.78 * 10.60/3.78 *

This interface is a member of the 10.60/3.78 * 10.60/3.78 * Java Collections Framework. 10.60/3.78 * 10.60/3.78 * @since 1.4 10.60/3.78 */ 10.60/3.78 public interface RandomAccess { 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 public class Random { 10.60/3.78 static String[] args; 10.60/3.78 static int index = 0; 10.60/3.78 10.60/3.78 public static int random() { 10.60/3.78 String string = args[index]; 10.60/3.78 index++; 10.60/3.78 return string.length(); 10.60/3.78 } 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 /* 10.60/3.78 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.78 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.78 * 10.60/3.78 * This code is free software; you can redistribute it and/or modify it 10.60/3.78 * under the terms of the GNU General Public License version 2 only, as 10.60/3.78 * published by the Free Software Foundation. Sun designates this 10.60/3.78 * particular file as subject to the "Classpath" exception as provided 10.60/3.78 * by Sun in the LICENSE file that accompanied this code. 10.60/3.78 * 10.60/3.78 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.78 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.78 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.78 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.78 * accompanied this code). 10.60/3.78 * 10.60/3.78 * You should have received a copy of the GNU General Public License version 10.60/3.78 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.78 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Thrown to indicate that the requested operation is not supported.

10.60/3.78 * 10.60/3.78 * This class is a member of the 10.60/3.78 * 10.60/3.78 * Java Collections Framework. 10.60/3.78 * 10.60/3.78 * @author Josh Bloch 10.60/3.78 * @since 1.2 10.60/3.78 */ 10.60/3.78 public class UnsupportedOperationException extends RuntimeException { 10.60/3.78 /** 10.60/3.78 * Constructs an UnsupportedOperationException with no detail message. 10.60/3.78 */ 10.60/3.78 public UnsupportedOperationException() { 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Constructs an UnsupportedOperationException with the specified 10.60/3.78 * detail message. 10.60/3.78 * 10.60/3.78 * @param message the detail message 10.60/3.78 */ 10.60/3.78 public UnsupportedOperationException(String message) { 10.60/3.78 super(message); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Constructs a new exception with the specified detail message and 10.60/3.78 * cause. 10.60/3.78 * 10.60/3.78 *

Note that the detail message associated with cause is 10.60/3.78 * not automatically incorporated in this exception's detail 10.60/3.78 * message. 10.60/3.78 * 10.60/3.78 * @param message the detail message (which is saved for later retrieval 10.60/3.78 * by the {@link Throwable#getMessage()} method). 10.60/3.78 * @param cause the cause (which is saved for later retrieval by the 10.60/3.78 * {@link Throwable#getCause()} method). (A null value 10.60/3.78 * is permitted, and indicates that the cause is nonexistent or 10.60/3.78 * unknown.) 10.60/3.78 * @since 1.5 10.60/3.78 */ 10.60/3.78 public UnsupportedOperationException(String message, Throwable cause) { 10.60/3.78 super(message, cause); 10.60/3.78 } 10.60/3.78 10.60/3.78 /** 10.60/3.78 * Constructs a new exception with the specified cause and a detail 10.60/3.78 * message of (cause==null ? null : cause.toString()) (which 10.60/3.78 * typically contains the class and detail message of cause). 10.60/3.78 * This constructor is useful for exceptions that are little more than 10.60/3.78 * wrappers for other throwables (for example, {@link 10.60/3.78 * java.security.PrivilegedActionException}). 10.60/3.78 * 10.60/3.78 * @param cause the cause (which is saved for later retrieval by the 10.60/3.78 * {@link Throwable#getCause()} method). (A null value is 10.60/3.78 * permitted, and indicates that the cause is nonexistent or 10.60/3.78 * unknown.) 10.60/3.78 * @since 1.5 10.60/3.78 */ 10.60/3.78 public UnsupportedOperationException(Throwable cause) { 10.60/3.78 super(cause); 10.60/3.78 } 10.60/3.78 10.60/3.78 static final long serialVersionUID = -1242599979055084673L; 10.60/3.78 } 10.60/3.78 10.60/3.78 10.60/3.78 10.60/3.78 ---------------------------------------- 10.60/3.78 10.60/3.78 (1) BareJBCToJBCProof (EQUIVALENT) 10.60/3.78 initialized classpath 10.60/3.78 ---------------------------------------- 10.60/3.78 10.60/3.78 (2) 10.60/3.78 Obligation: 10.60/3.78 need to prove termination of the following program: 10.60/3.78 /* 10.60/3.78 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.78 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.78 * 10.60/3.78 * This code is free software; you can redistribute it and/or modify it 10.60/3.78 * under the terms of the GNU General Public License version 2 only, as 10.60/3.78 * published by the Free Software Foundation. Sun designates this 10.60/3.78 * particular file as subject to the "Classpath" exception as provided 10.60/3.78 * by Sun in the LICENSE file that accompanied this code. 10.60/3.78 * 10.60/3.78 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.78 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.78 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.78 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.78 * accompanied this code). 10.60/3.78 * 10.60/3.78 * You should have received a copy of the GNU General Public License version 10.60/3.78 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.78 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.78 * 10.60/3.78 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.78 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.78 * have any questions. 10.60/3.78 */ 10.60/3.78 10.60/3.78 package javaUtilEx; 10.60/3.78 10.60/3.78 /** 10.60/3.78 * This class provides a skeletal implementation of the Collection 10.60/3.78 * interface, to minimize the effort required to implement this interface.

10.60/3.78 * 10.60/3.78 * To implement an unmodifiable collection, the programmer needs only to 10.60/3.78 * extend this class and provide implementations for the iterator and 10.60/3.78 * size methods. (The iterator returned by the iterator 10.60/3.78 * method must implement hasNext and next.)

10.60/3.79 * 10.60/3.79 * To implement a modifiable collection, the programmer must additionally 10.60/3.79 * override this class's add method (which otherwise throws an 10.60/3.79 * UnsupportedOperationException), and the iterator returned by the 10.60/3.79 * iterator method must additionally implement its remove 10.60/3.79 * method.

10.60/3.79 * 10.60/3.79 * The programmer should generally provide a void (no argument) and 10.60/3.79 * Collection constructor, as per the recommendation in the 10.60/3.79 * Collection interface specification.

10.60/3.79 * 10.60/3.79 * The documentation for each non-abstract method in this class describes its 10.60/3.79 * implementation in detail. Each of these methods may be overridden if 10.60/3.79 * the collection being implemented admits a more efficient implementation.

10.60/3.79 * 10.60/3.79 * This class is a member of the 10.60/3.79 * 10.60/3.79 * Java Collections Framework. 10.60/3.79 * 10.60/3.79 * @author Josh Bloch 10.60/3.79 * @author Neal Gafter 10.60/3.79 * @see Collection 10.60/3.79 * @since 1.2 10.60/3.79 */ 10.60/3.79 10.60/3.79 public abstract class AbstractCollection implements Collection { 10.60/3.79 /** 10.60/3.79 * Sole constructor. (For invocation by subclass constructors, typically 10.60/3.79 * implicit.) 10.60/3.79 */ 10.60/3.79 protected AbstractCollection() { 10.60/3.79 } 10.60/3.79 10.60/3.79 // Query Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns an iterator over the elements contained in this collection. 10.60/3.79 * 10.60/3.79 * @return an iterator over the elements contained in this collection 10.60/3.79 */ 10.60/3.79 public abstract Iterator iterator(); 10.60/3.79 10.60/3.79 public abstract int size(); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation returns size() == 0. 10.60/3.79 */ 10.60/3.79 public boolean isEmpty() { 10.60/3.79 return size() == 0; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation iterates over the elements in the collection, 10.60/3.79 * checking each element in turn for equality with the specified element. 10.60/3.79 * 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public boolean contains(Object o) { 10.60/3.79 Iterator e = iterator(); 10.60/3.79 if (o==null) { 10.60/3.79 while (e.hasNext()) 10.60/3.79 if (e.next()==null) 10.60/3.79 return true; 10.60/3.79 } else { 10.60/3.79 while (e.hasNext()) 10.60/3.79 if (o.equals(e.next())) 10.60/3.79 return true; 10.60/3.79 } 10.60/3.79 return false; 10.60/3.79 } 10.60/3.79 10.60/3.79 // Modification Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation always throws an 10.60/3.79 * UnsupportedOperationException. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IllegalStateException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public boolean add(E e) { 10.60/3.79 throw new UnsupportedOperationException(); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation iterates over the collection looking for the 10.60/3.79 * specified element. If it finds the element, it removes the element 10.60/3.79 * from the collection using the iterator's remove method. 10.60/3.79 * 10.60/3.79 *

Note that this implementation throws an 10.60/3.79 * UnsupportedOperationException if the iterator returned by this 10.60/3.79 * collection's iterator method does not implement the remove 10.60/3.79 * method and this collection contains the specified object. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public boolean remove(Object o) { 10.60/3.79 Iterator e = iterator(); 10.60/3.79 if (o==null) { 10.60/3.79 while (e.hasNext()) { 10.60/3.79 if (e.next()==null) { 10.60/3.79 e.remove(); 10.60/3.79 return true; 10.60/3.79 } 10.60/3.79 } 10.60/3.79 } else { 10.60/3.79 while (e.hasNext()) { 10.60/3.79 if (o.equals(e.next())) { 10.60/3.79 e.remove(); 10.60/3.79 return true; 10.60/3.79 } 10.60/3.79 } 10.60/3.79 } 10.60/3.79 return false; 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 // Bulk Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation iterates over the specified collection, 10.60/3.79 * checking each element returned by the iterator in turn to see 10.60/3.79 * if it's contained in this collection. If all elements are so 10.60/3.79 * contained true is returned, otherwise false. 10.60/3.79 * 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @see #contains(Object) 10.60/3.79 */ 10.60/3.79 public boolean containsAll(Collection c) { 10.60/3.79 Iterator e = c.iterator(); 10.60/3.79 while (e.hasNext()) 10.60/3.79 if (!contains(e.next())) 10.60/3.79 return false; 10.60/3.79 return true; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation iterates over the specified collection, and adds 10.60/3.79 * each object returned by the iterator to this collection, in turn. 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException unless add is 10.60/3.79 * overridden (assuming the specified collection is non-empty). 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IllegalStateException {@inheritDoc} 10.60/3.79 * 10.60/3.79 * @see #add(Object) 10.60/3.79 */ 10.60/3.79 public boolean addAll(Collection c) { 10.60/3.79 boolean modified = false; 10.60/3.79 Iterator e = c.iterator(); 10.60/3.79 while (e.hasNext()) { 10.60/3.79 if (add(e.next())) 10.60/3.79 modified = true; 10.60/3.79 } 10.60/3.79 return modified; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation iterates over this collection, checking each 10.60/3.79 * element returned by the iterator in turn to see if it's contained 10.60/3.79 * in the specified collection. If it's so contained, it's removed from 10.60/3.79 * this collection with the iterator's remove method. 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException if the iterator returned by the 10.60/3.79 * iterator method does not implement the remove method 10.60/3.79 * and this collection contains one or more elements in common with the 10.60/3.79 * specified collection. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * 10.60/3.79 * @see #remove(Object) 10.60/3.79 * @see #contains(Object) 10.60/3.79 */ 10.60/3.79 public boolean removeAll(Collection c) { 10.60/3.79 boolean modified = false; 10.60/3.79 Iterator e = iterator(); 10.60/3.79 while (e.hasNext()) { 10.60/3.79 if (c.contains(e.next())) { 10.60/3.79 e.remove(); 10.60/3.79 modified = true; 10.60/3.79 } 10.60/3.79 } 10.60/3.79 return modified; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation iterates over this collection, checking each 10.60/3.79 * element returned by the iterator in turn to see if it's contained 10.60/3.79 * in the specified collection. If it's not so contained, it's removed 10.60/3.79 * from this collection with the iterator's remove method. 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException if the iterator returned by the 10.60/3.79 * iterator method does not implement the remove method 10.60/3.79 * and this collection contains one or more elements not present in the 10.60/3.79 * specified collection. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * 10.60/3.79 * @see #remove(Object) 10.60/3.79 * @see #contains(Object) 10.60/3.79 */ 10.60/3.79 public boolean retainAll(Collection c) { 10.60/3.79 boolean modified = false; 10.60/3.79 Iterator e = iterator(); 10.60/3.79 while (e.hasNext()) { 10.60/3.79 if (!c.contains(e.next())) { 10.60/3.79 e.remove(); 10.60/3.79 modified = true; 10.60/3.79 } 10.60/3.79 } 10.60/3.79 return modified; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation iterates over this collection, removing each 10.60/3.79 * element using the Iterator.remove operation. Most 10.60/3.79 * implementations will probably choose to override this method for 10.60/3.79 * efficiency. 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException if the iterator returned by this 10.60/3.79 * collection's iterator method does not implement the 10.60/3.79 * remove method and this collection is non-empty. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public void clear() { 10.60/3.79 Iterator e = iterator(); 10.60/3.79 while (e.hasNext()) { 10.60/3.79 e.next(); 10.60/3.79 e.remove(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 // String conversion 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns a string representation of this collection. The string 10.60/3.79 * representation consists of a list of the collection's elements in the 10.60/3.79 * order they are returned by its iterator, enclosed in square brackets 10.60/3.79 * ("[]"). Adjacent elements are separated by the characters 10.60/3.79 * ", " (comma and space). Elements are converted to strings as 10.60/3.79 * by {@link String#valueOf(Object)}. 10.60/3.79 * 10.60/3.79 * @return a string representation of this collection 10.60/3.79 */ 10.60/3.79 public String toString() { 10.60/3.79 Iterator i = iterator(); 10.60/3.79 if (! i.hasNext()) 10.60/3.79 return "[]"; 10.60/3.79 10.60/3.79 String sb = ""; 10.60/3.79 sb = sb + "["; 10.60/3.79 for (;;) { 10.60/3.79 E e = i.next(); 10.60/3.79 sb = sb + (e == this ? "(this Collection)" : e); 10.60/3.79 if (! i.hasNext()) { 10.60/3.79 sb = sb + "]"; 10.60/3.79 return sb; 10.60/3.79 } 10.60/3.79 sb = sb + ", "; 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 /* 10.60/3.79 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.79 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.79 * 10.60/3.79 * This code is free software; you can redistribute it and/or modify it 10.60/3.79 * under the terms of the GNU General Public License version 2 only, as 10.60/3.79 * published by the Free Software Foundation. Sun designates this 10.60/3.79 * particular file as subject to the "Classpath" exception as provided 10.60/3.79 * by Sun in the LICENSE file that accompanied this code. 10.60/3.79 * 10.60/3.79 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.79 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.79 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.79 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.79 * accompanied this code). 10.60/3.79 * 10.60/3.79 * You should have received a copy of the GNU General Public License version 10.60/3.79 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.79 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.79 * 10.60/3.79 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.79 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.79 * have any questions. 10.60/3.79 */ 10.60/3.79 10.60/3.79 package javaUtilEx; 10.60/3.79 10.60/3.79 /** 10.60/3.79 * This class provides a skeletal implementation of the {@link List} 10.60/3.79 * interface to minimize the effort required to implement this interface 10.60/3.79 * backed by a "random access" data store (such as an array). For sequential 10.60/3.79 * access data (such as a linked list), {@link AbstractSequentialList} should 10.60/3.79 * be used in preference to this class. 10.60/3.79 * 10.60/3.79 *

To implement an unmodifiable list, the programmer needs only to extend 10.60/3.79 * this class and provide implementations for the {@link #get(int)} and 10.60/3.79 * {@link List#size() size()} methods. 10.60/3.79 * 10.60/3.79 *

To implement a modifiable list, the programmer must additionally 10.60/3.79 * override the {@link #set(int, Object) set(int, E)} method (which otherwise 10.60/3.79 * throws an {@code UnsupportedOperationException}). If the list is 10.60/3.79 * variable-size the programmer must additionally override the 10.60/3.79 * {@link #add(int, Object) add(int, E)} and {@link #remove(int)} methods. 10.60/3.79 * 10.60/3.79 *

The programmer should generally provide a void (no argument) and collection 10.60/3.79 * constructor, as per the recommendation in the {@link Collection} interface 10.60/3.79 * specification. 10.60/3.79 * 10.60/3.79 *

Unlike the other abstract collection implementations, the programmer does 10.60/3.79 * not have to provide an iterator implementation; the iterator and 10.60/3.79 * list iterator are implemented by this class, on top of the "random access" 10.60/3.79 * methods: 10.60/3.79 * {@link #get(int)}, 10.60/3.79 * {@link #set(int, Object) set(int, E)}, 10.60/3.79 * {@link #add(int, Object) add(int, E)} and 10.60/3.79 * {@link #remove(int)}. 10.60/3.79 * 10.60/3.79 *

The documentation for each non-abstract method in this class describes its 10.60/3.79 * implementation in detail. Each of these methods may be overridden if the 10.60/3.79 * collection being implemented admits a more efficient implementation. 10.60/3.79 * 10.60/3.79 *

This class is a member of the 10.60/3.79 * 10.60/3.79 * Java Collections Framework. 10.60/3.79 * 10.60/3.79 * @author Josh Bloch 10.60/3.79 * @author Neal Gafter 10.60/3.79 * @since 1.2 10.60/3.79 */ 10.60/3.79 10.60/3.79 public abstract class AbstractList extends AbstractCollection implements List { 10.60/3.79 /** 10.60/3.79 * Sole constructor. (For invocation by subclass constructors, typically 10.60/3.79 * implicit.) 10.60/3.79 */ 10.60/3.79 protected AbstractList() { 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Appends the specified element to the end of this list (optional 10.60/3.79 * operation). 10.60/3.79 * 10.60/3.79 *

Lists that support this operation may place limitations on what 10.60/3.79 * elements may be added to this list. In particular, some 10.60/3.79 * lists will refuse to add null elements, and others will impose 10.60/3.79 * restrictions on the type of elements that may be added. List 10.60/3.79 * classes should clearly specify in their documentation any restrictions 10.60/3.79 * on what elements may be added. 10.60/3.79 * 10.60/3.79 *

This implementation calls {@code add(size(), e)}. 10.60/3.79 * 10.60/3.79 *

Note that this implementation throws an 10.60/3.79 * {@code UnsupportedOperationException} unless 10.60/3.79 * {@link #add(int, Object) add(int, E)} is overridden. 10.60/3.79 * 10.60/3.79 * @param e element to be appended to this list 10.60/3.79 * @return {@code true} (as specified by {@link Collection#add}) 10.60/3.79 * @throws UnsupportedOperationException if the {@code add} operation 10.60/3.79 * is not supported by this list 10.60/3.79 * @throws ClassCastException if the class of the specified element 10.60/3.79 * prevents it from being added to this list 10.60/3.79 * @throws NullPointerException if the specified element is null and this 10.60/3.79 * list does not permit null elements 10.60/3.79 * @throws IllegalArgumentException if some property of this element 10.60/3.79 * prevents it from being added to this list 10.60/3.79 */ 10.60/3.79 public boolean add(E e) { 10.60/3.79 add(size(), e); 10.60/3.79 return true; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 abstract public E get(int index); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation always throws an 10.60/3.79 * {@code UnsupportedOperationException}. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public E set(int index, E element) { 10.60/3.79 throw new UnsupportedOperationException(); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation always throws an 10.60/3.79 * {@code UnsupportedOperationException}. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public void add(int index, E element) { 10.60/3.79 throw new UnsupportedOperationException(); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation always throws an 10.60/3.79 * {@code UnsupportedOperationException}. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public E remove(int index) { 10.60/3.79 throw new UnsupportedOperationException(); 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 // Search Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation first gets a list iterator (with 10.60/3.79 * {@code listIterator()}). Then, it iterates over the list until the 10.60/3.79 * specified element is found or the end of the list is reached. 10.60/3.79 * 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public int indexOf(Object o) { 10.60/3.79 ListIterator e = listIterator(); 10.60/3.79 if (o==null) { 10.60/3.79 while (e.hasNext()) 10.60/3.79 if (e.next()==null) 10.60/3.79 return e.previousIndex(); 10.60/3.79 } else { 10.60/3.79 while (e.hasNext()) 10.60/3.79 if (o.equals(e.next())) 10.60/3.79 return e.previousIndex(); 10.60/3.79 } 10.60/3.79 return -1; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation first gets a list iterator that points to the end 10.60/3.79 * of the list (with {@code listIterator(size())}). Then, it iterates 10.60/3.79 * backwards over the list until the specified element is found, or the 10.60/3.79 * beginning of the list is reached. 10.60/3.79 * 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public int lastIndexOf(Object o) { 10.60/3.79 ListIterator e = listIterator(size()); 10.60/3.79 if (o==null) { 10.60/3.79 while (e.hasPrevious()) 10.60/3.79 if (e.previous()==null) 10.60/3.79 return e.nextIndex(); 10.60/3.79 } else { 10.60/3.79 while (e.hasPrevious()) 10.60/3.79 if (o.equals(e.previous())) 10.60/3.79 return e.nextIndex(); 10.60/3.79 } 10.60/3.79 return -1; 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 // Bulk Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Removes all of the elements from this list (optional operation). 10.60/3.79 * The list will be empty after this call returns. 10.60/3.79 * 10.60/3.79 *

This implementation calls {@code removeRange(0, size())}. 10.60/3.79 * 10.60/3.79 *

Note that this implementation throws an 10.60/3.79 * {@code UnsupportedOperationException} unless {@code remove(int 10.60/3.79 * index)} or {@code removeRange(int fromIndex, int toIndex)} is 10.60/3.79 * overridden. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException if the {@code clear} operation 10.60/3.79 * is not supported by this list 10.60/3.79 */ 10.60/3.79 public void clear() { 10.60/3.79 removeRange(0, size()); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation gets an iterator over the specified collection 10.60/3.79 * and iterates over it, inserting the elements obtained from the 10.60/3.79 * iterator into this list at the appropriate position, one at a time, 10.60/3.79 * using {@code add(int, E)}. 10.60/3.79 * Many implementations will override this method for efficiency. 10.60/3.79 * 10.60/3.79 *

Note that this implementation throws an 10.60/3.79 * {@code UnsupportedOperationException} unless 10.60/3.79 * {@link #add(int, Object) add(int, E)} is overridden. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public boolean addAll(int index, Collection c) { 10.60/3.79 rangeCheckForAdd(index); 10.60/3.79 boolean modified = false; 10.60/3.79 Iterator e = c.iterator(); 10.60/3.79 while (e.hasNext()) { 10.60/3.79 add(index++, e.next()); 10.60/3.79 modified = true; 10.60/3.79 } 10.60/3.79 return modified; 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 // Iterators 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns an iterator over the elements in this list in proper sequence. 10.60/3.79 * 10.60/3.79 *

This implementation returns a straightforward implementation of the 10.60/3.79 * iterator interface, relying on the backing list's {@code size()}, 10.60/3.79 * {@code get(int)}, and {@code remove(int)} methods. 10.60/3.79 * 10.60/3.79 *

Note that the iterator returned by this method will throw an 10.60/3.79 * {@link UnsupportedOperationException} in response to its 10.60/3.79 * {@code remove} method unless the list's {@code remove(int)} method is 10.60/3.79 * overridden. 10.60/3.79 * 10.60/3.79 *

This implementation can be made to throw runtime exceptions in the 10.60/3.79 * face of concurrent modification, as described in the specification 10.60/3.79 * for the (protected) {@link #modCount} field. 10.60/3.79 * 10.60/3.79 * @return an iterator over the elements in this list in proper sequence 10.60/3.79 */ 10.60/3.79 public Iterator iterator() { 10.60/3.79 return new Itr(); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation returns {@code listIterator(0)}. 10.60/3.79 * 10.60/3.79 * @see #listIterator(int) 10.60/3.79 */ 10.60/3.79 public ListIterator listIterator() { 10.60/3.79 return listIterator(0); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation returns a straightforward implementation of the 10.60/3.79 * {@code ListIterator} interface that extends the implementation of the 10.60/3.79 * {@code Iterator} interface returned by the {@code iterator()} method. 10.60/3.79 * The {@code ListIterator} implementation relies on the backing list's 10.60/3.79 * {@code get(int)}, {@code set(int, E)}, {@code add(int, E)} 10.60/3.79 * and {@code remove(int)} methods. 10.60/3.79 * 10.60/3.79 *

Note that the list iterator returned by this implementation will 10.60/3.79 * throw an {@link UnsupportedOperationException} in response to its 10.60/3.79 * {@code remove}, {@code set} and {@code add} methods unless the 10.60/3.79 * list's {@code remove(int)}, {@code set(int, E)}, and 10.60/3.79 * {@code add(int, E)} methods are overridden. 10.60/3.79 * 10.60/3.79 *

This implementation can be made to throw runtime exceptions in the 10.60/3.79 * face of concurrent modification, as described in the specification for 10.60/3.79 * the (protected) {@link #modCount} field. 10.60/3.79 * 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public ListIterator listIterator(final int index) { 10.60/3.79 rangeCheckForAdd(index); 10.60/3.79 10.60/3.79 return new ListItr(index); 10.60/3.79 } 10.60/3.79 10.60/3.79 private class Itr implements Iterator { 10.60/3.79 /** 10.60/3.79 * Index of element to be returned by subsequent call to next. 10.60/3.79 */ 10.60/3.79 int cursor = 0; 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Index of element returned by most recent call to next or 10.60/3.79 * previous. Reset to -1 if this element is deleted by a call 10.60/3.79 * to remove. 10.60/3.79 */ 10.60/3.79 int lastRet = -1; 10.60/3.79 10.60/3.79 /** 10.60/3.79 * The modCount value that the iterator believes that the backing 10.60/3.79 * List should have. If this expectation is violated, the iterator 10.60/3.79 * has detected concurrent modification. 10.60/3.79 */ 10.60/3.79 int expectedModCount = modCount; 10.60/3.79 10.60/3.79 public boolean hasNext() { 10.60/3.79 return cursor != size(); 10.60/3.79 } 10.60/3.79 10.60/3.79 public E next() { 10.60/3.79 checkForComodification(); 10.60/3.79 try { 10.60/3.79 int i = cursor; 10.60/3.79 E next = get(i); 10.60/3.79 lastRet = i; 10.60/3.79 cursor = i + 1; 10.60/3.79 return next; 10.60/3.79 } catch (IndexOutOfBoundsException e) { 10.60/3.79 checkForComodification(); 10.60/3.79 throw new NoSuchElementException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 public void remove() { 10.60/3.79 if (lastRet < 0) 10.60/3.79 throw new IllegalStateException(); 10.60/3.79 checkForComodification(); 10.60/3.79 10.60/3.79 try { 10.60/3.79 AbstractList.this.remove(lastRet); 10.60/3.79 if (lastRet < cursor) 10.60/3.79 cursor--; 10.60/3.79 lastRet = -1; 10.60/3.79 expectedModCount = modCount; 10.60/3.79 } catch (IndexOutOfBoundsException e) { 10.60/3.79 throw new ConcurrentModificationException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 final void checkForComodification() { 10.60/3.79 if (modCount != expectedModCount) 10.60/3.79 throw new ConcurrentModificationException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 private class ListItr extends Itr implements ListIterator { 10.60/3.79 ListItr(int index) { 10.60/3.79 cursor = index; 10.60/3.79 } 10.60/3.79 10.60/3.79 public boolean hasPrevious() { 10.60/3.79 return cursor != 0; 10.60/3.79 } 10.60/3.79 10.60/3.79 public E previous() { 10.60/3.79 checkForComodification(); 10.60/3.79 try { 10.60/3.79 int i = cursor - 1; 10.60/3.79 E previous = get(i); 10.60/3.79 lastRet = cursor = i; 10.60/3.79 return previous; 10.60/3.79 } catch (IndexOutOfBoundsException e) { 10.60/3.79 checkForComodification(); 10.60/3.79 throw new NoSuchElementException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 public int nextIndex() { 10.60/3.79 return cursor; 10.60/3.79 } 10.60/3.79 10.60/3.79 public int previousIndex() { 10.60/3.79 return cursor-1; 10.60/3.79 } 10.60/3.79 10.60/3.79 public void set(E e) { 10.60/3.79 if (lastRet < 0) 10.60/3.79 throw new IllegalStateException(); 10.60/3.79 checkForComodification(); 10.60/3.79 10.60/3.79 try { 10.60/3.79 AbstractList.this.set(lastRet, e); 10.60/3.79 expectedModCount = modCount; 10.60/3.79 } catch (IndexOutOfBoundsException ex) { 10.60/3.79 throw new ConcurrentModificationException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 public void add(E e) { 10.60/3.79 checkForComodification(); 10.60/3.79 10.60/3.79 try { 10.60/3.79 int i = cursor; 10.60/3.79 AbstractList.this.add(i, e); 10.60/3.79 lastRet = -1; 10.60/3.79 cursor = i + 1; 10.60/3.79 expectedModCount = modCount; 10.60/3.79 } catch (IndexOutOfBoundsException ex) { 10.60/3.79 throw new ConcurrentModificationException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * {@inheritDoc} 10.60/3.79 * 10.60/3.79 *

This implementation returns a list that subclasses 10.60/3.79 * {@code AbstractList}. The subclass stores, in private fields, the 10.60/3.79 * offset of the subList within the backing list, the size of the subList 10.60/3.79 * (which can change over its lifetime), and the expected 10.60/3.79 * {@code modCount} value of the backing list. There are two variants 10.60/3.79 * of the subclass, one of which implements {@code RandomAccess}. 10.60/3.79 * If this list implements {@code RandomAccess} the returned list will 10.60/3.79 * be an instance of the subclass that implements {@code RandomAccess}. 10.60/3.79 * 10.60/3.79 *

The subclass's {@code set(int, E)}, {@code get(int)}, 10.60/3.79 * {@code add(int, E)}, {@code remove(int)}, {@code addAll(int, 10.60/3.79 * Collection)} and {@code removeRange(int, int)} methods all 10.60/3.79 * delegate to the corresponding methods on the backing abstract list, 10.60/3.79 * after bounds-checking the index and adjusting for the offset. The 10.60/3.79 * {@code addAll(Collection c)} method merely returns {@code addAll(size, 10.60/3.79 * c)}. 10.60/3.79 * 10.60/3.79 *

The {@code listIterator(int)} method returns a "wrapper object" 10.60/3.79 * over a list iterator on the backing list, which is created with the 10.60/3.79 * corresponding method on the backing list. The {@code iterator} method 10.60/3.79 * merely returns {@code listIterator()}, and the {@code size} method 10.60/3.79 * merely returns the subclass's {@code size} field. 10.60/3.79 * 10.60/3.79 *

All methods first check to see if the actual {@code modCount} of 10.60/3.79 * the backing list is equal to its expected value, and throw a 10.60/3.79 * {@code ConcurrentModificationException} if it is not. 10.60/3.79 * 10.60/3.79 * @throws IndexOutOfBoundsException if an endpoint index value is out of range 10.60/3.79 * {@code (fromIndex < 0 || toIndex > size)} 10.60/3.79 * @throws IllegalArgumentException if the endpoint indices are out of order 10.60/3.79 * {@code (fromIndex > toIndex)} 10.60/3.79 */ 10.60/3.79 public List subList(int fromIndex, int toIndex) { 10.60/3.79 return (this instanceof RandomAccess ? 10.60/3.79 new RandomAccessSubList(this, fromIndex, toIndex) : 10.60/3.79 new SubList(this, fromIndex, toIndex)); 10.60/3.79 } 10.60/3.79 10.60/3.79 // Comparison and hashing 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Compares the specified object with this list for equality. Returns 10.60/3.79 * {@code true} if and only if the specified object is also a list, both 10.60/3.79 * lists have the same size, and all corresponding pairs of elements in 10.60/3.79 * the two lists are equal. (Two elements {@code e1} and 10.60/3.79 * {@code e2} are equal if {@code (e1==null ? e2==null : 10.60/3.79 * e1.equals(e2))}.) In other words, two lists are defined to be 10.60/3.79 * equal if they contain the same elements in the same order.

10.60/3.79 * 10.60/3.79 * This implementation first checks if the specified object is this 10.60/3.79 * list. If so, it returns {@code true}; if not, it checks if the 10.60/3.79 * specified object is a list. If not, it returns {@code false}; if so, 10.60/3.79 * it iterates over both lists, comparing corresponding pairs of elements. 10.60/3.79 * If any comparison returns {@code false}, this method returns 10.60/3.79 * {@code false}. If either iterator runs out of elements before the 10.60/3.79 * other it returns {@code false} (as the lists are of unequal length); 10.60/3.79 * otherwise it returns {@code true} when the iterations complete. 10.60/3.79 * 10.60/3.79 * @param o the object to be compared for equality with this list 10.60/3.79 * @return {@code true} if the specified object is equal to this list 10.60/3.79 */ 10.60/3.79 public boolean equals(Object o) { 10.60/3.79 if (o == this) 10.60/3.79 return true; 10.60/3.79 if (!(o instanceof List)) 10.60/3.79 return false; 10.60/3.79 10.60/3.79 ListIterator e1 = listIterator(); 10.60/3.79 ListIterator e2 = ((List) o).listIterator(); 10.60/3.79 while(e1.hasNext() && e2.hasNext()) { 10.60/3.79 E o1 = e1.next(); 10.60/3.79 Object o2 = e2.next(); 10.60/3.79 if (!(o1==null ? o2==null : o1.equals(o2))) 10.60/3.79 return false; 10.60/3.79 } 10.60/3.79 return !(e1.hasNext() || e2.hasNext()); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns the hash code value for this list. 10.60/3.79 * 10.60/3.79 *

This implementation uses exactly the code that is used to define the 10.60/3.79 * list hash function in the documentation for the {@link List#hashCode} 10.60/3.79 * method. 10.60/3.79 * 10.60/3.79 * @return the hash code value for this list 10.60/3.79 */ 10.60/3.79 public int hashCode() { 10.60/3.79 int hashCode = 1; 10.60/3.79 Iterator it = this.iterator(); 10.60/3.79 while (it.hasNext()) { 10.60/3.79 E e = it.next(); 10.60/3.79 hashCode = 31*hashCode + (e==null ? 0 : e.hashCode()); 10.60/3.79 } 10.60/3.79 return hashCode; 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Removes from this list all of the elements whose index is between 10.60/3.79 * {@code fromIndex}, inclusive, and {@code toIndex}, exclusive. 10.60/3.79 * Shifts any succeeding elements to the left (reduces their index). 10.60/3.79 * This call shortens the list by {@code (toIndex - fromIndex)} elements. 10.60/3.79 * (If {@code toIndex==fromIndex}, this operation has no effect.) 10.60/3.79 * 10.60/3.79 *

This method is called by the {@code clear} operation on this list 10.60/3.79 * and its subLists. Overriding this method to take advantage of 10.60/3.79 * the internals of the list implementation can substantially 10.60/3.79 * improve the performance of the {@code clear} operation on this list 10.60/3.79 * and its subLists. 10.60/3.79 * 10.60/3.79 *

This implementation gets a list iterator positioned before 10.60/3.79 * {@code fromIndex}, and repeatedly calls {@code ListIterator.next} 10.60/3.79 * followed by {@code ListIterator.remove} until the entire range has 10.60/3.79 * been removed. Note: if {@code ListIterator.remove} requires linear 10.60/3.79 * time, this implementation requires quadratic time. 10.60/3.79 * 10.60/3.79 * @param fromIndex index of first element to be removed 10.60/3.79 * @param toIndex index after last element to be removed 10.60/3.79 */ 10.60/3.79 protected void removeRange(int fromIndex, int toIndex) { 10.60/3.79 ListIterator it = listIterator(fromIndex); 10.60/3.79 for (int i=0, n=toIndex-fromIndex; istructurally modified. 10.60/3.79 * Structural modifications are those that change the size of the 10.60/3.79 * list, or otherwise perturb it in such a fashion that iterations in 10.60/3.79 * progress may yield incorrect results. 10.60/3.79 * 10.60/3.79 *

This field is used by the iterator and list iterator implementation 10.60/3.79 * returned by the {@code iterator} and {@code listIterator} methods. 10.60/3.79 * If the value of this field changes unexpectedly, the iterator (or list 10.60/3.79 * iterator) will throw a {@code ConcurrentModificationException} in 10.60/3.79 * response to the {@code next}, {@code remove}, {@code previous}, 10.60/3.79 * {@code set} or {@code add} operations. This provides 10.60/3.79 * fail-fast behavior, rather than non-deterministic behavior in 10.60/3.79 * the face of concurrent modification during iteration. 10.60/3.79 * 10.60/3.79 *

Use of this field by subclasses is optional. If a subclass 10.60/3.79 * wishes to provide fail-fast iterators (and list iterators), then it 10.60/3.79 * merely has to increment this field in its {@code add(int, E)} and 10.60/3.79 * {@code remove(int)} methods (and any other methods that it overrides 10.60/3.79 * that result in structural modifications to the list). A single call to 10.60/3.79 * {@code add(int, E)} or {@code remove(int)} must add no more than 10.60/3.79 * one to this field, or the iterators (and list iterators) will throw 10.60/3.79 * bogus {@code ConcurrentModificationExceptions}. If an implementation 10.60/3.79 * does not wish to provide fail-fast iterators, this field may be 10.60/3.79 * ignored. 10.60/3.79 */ 10.60/3.79 protected transient int modCount = 0; 10.60/3.79 10.60/3.79 private void rangeCheckForAdd(int index) { 10.60/3.79 if (index < 0 || index > size()) 10.60/3.79 throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); 10.60/3.79 } 10.60/3.79 10.60/3.79 private String outOfBoundsMsg(int index) { 10.60/3.79 return ""; 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 class SubList extends AbstractList { 10.60/3.79 private final AbstractList l; 10.60/3.79 private final int offset; 10.60/3.79 private int size; 10.60/3.79 10.60/3.79 SubList(AbstractList list, int fromIndex, int toIndex) { 10.60/3.79 if (fromIndex < 0) 10.60/3.79 throw new IndexOutOfBoundsException(); 10.60/3.79 if (toIndex > list.size()) 10.60/3.79 throw new IndexOutOfBoundsException(); 10.60/3.79 if (fromIndex > toIndex) 10.60/3.79 throw new IllegalArgumentException(); 10.60/3.79 l = list; 10.60/3.79 offset = fromIndex; 10.60/3.79 size = toIndex - fromIndex; 10.60/3.79 this.modCount = l.modCount; 10.60/3.79 } 10.60/3.79 10.60/3.79 public E set(int index, E element) { 10.60/3.79 rangeCheck(index); 10.60/3.79 checkForComodification(); 10.60/3.79 return l.set(index+offset, element); 10.60/3.79 } 10.60/3.79 10.60/3.79 public E get(int index) { 10.60/3.79 rangeCheck(index); 10.60/3.79 checkForComodification(); 10.60/3.79 return l.get(index+offset); 10.60/3.79 } 10.60/3.79 10.60/3.79 public int size() { 10.60/3.79 checkForComodification(); 10.60/3.79 return size; 10.60/3.79 } 10.60/3.79 10.60/3.79 public void add(int index, E element) { 10.60/3.79 rangeCheckForAdd(index); 10.60/3.79 checkForComodification(); 10.60/3.79 l.add(index+offset, element); 10.60/3.79 this.modCount = l.modCount; 10.60/3.79 size++; 10.60/3.79 } 10.60/3.79 10.60/3.79 public E remove(int index) { 10.60/3.79 rangeCheck(index); 10.60/3.79 checkForComodification(); 10.60/3.79 E result = l.remove(index+offset); 10.60/3.79 this.modCount = l.modCount; 10.60/3.79 size--; 10.60/3.79 return result; 10.60/3.79 } 10.60/3.79 10.60/3.79 protected void removeRange(int fromIndex, int toIndex) { 10.60/3.79 checkForComodification(); 10.60/3.79 l.removeRange(fromIndex+offset, toIndex+offset); 10.60/3.79 this.modCount = l.modCount; 10.60/3.79 size -= (toIndex-fromIndex); 10.60/3.79 } 10.60/3.79 10.60/3.79 public boolean addAll(Collection c) { 10.60/3.79 return addAll(size, c); 10.60/3.79 } 10.60/3.79 10.60/3.79 public boolean addAll(int index, Collection c) { 10.60/3.79 rangeCheckForAdd(index); 10.60/3.79 int cSize = c.size(); 10.60/3.79 if (cSize==0) 10.60/3.79 return false; 10.60/3.79 10.60/3.79 checkForComodification(); 10.60/3.79 l.addAll(offset+index, c); 10.60/3.79 this.modCount = l.modCount; 10.60/3.79 size += cSize; 10.60/3.79 return true; 10.60/3.79 } 10.60/3.79 10.60/3.79 public Iterator iterator() { 10.60/3.79 return listIterator(); 10.60/3.79 } 10.60/3.79 10.60/3.79 public ListIterator listIterator(final int index) { 10.60/3.79 checkForComodification(); 10.60/3.79 rangeCheckForAdd(index); 10.60/3.79 10.60/3.79 return new ListIterator() { 10.60/3.79 private final ListIterator i = l.listIterator(index+offset); 10.60/3.79 10.60/3.79 public boolean hasNext() { 10.60/3.79 return nextIndex() < size; 10.60/3.79 } 10.60/3.79 10.60/3.79 public E next() { 10.60/3.79 if (hasNext()) 10.60/3.79 return i.next(); 10.60/3.79 else 10.60/3.79 throw new NoSuchElementException(); 10.60/3.79 } 10.60/3.79 10.60/3.79 public boolean hasPrevious() { 10.60/3.79 return previousIndex() >= 0; 10.60/3.79 } 10.60/3.79 10.60/3.79 public E previous() { 10.60/3.79 if (hasPrevious()) 10.60/3.79 return i.previous(); 10.60/3.79 else 10.60/3.79 throw new NoSuchElementException(); 10.60/3.79 } 10.60/3.79 10.60/3.79 public int nextIndex() { 10.60/3.79 return i.nextIndex() - offset; 10.60/3.79 } 10.60/3.79 10.60/3.79 public int previousIndex() { 10.60/3.79 return i.previousIndex() - offset; 10.60/3.79 } 10.60/3.79 10.60/3.79 public void remove() { 10.60/3.79 i.remove(); 10.60/3.79 SubList.this.modCount = l.modCount; 10.60/3.79 size--; 10.60/3.79 } 10.60/3.79 10.60/3.79 public void set(E e) { 10.60/3.79 i.set(e); 10.60/3.79 } 10.60/3.79 10.60/3.79 public void add(E e) { 10.60/3.79 i.add(e); 10.60/3.79 SubList.this.modCount = l.modCount; 10.60/3.79 size++; 10.60/3.79 } 10.60/3.79 }; 10.60/3.79 } 10.60/3.79 10.60/3.79 public List subList(int fromIndex, int toIndex) { 10.60/3.79 return new SubList(this, fromIndex, toIndex); 10.60/3.79 } 10.60/3.79 10.60/3.79 private void rangeCheck(int index) { 10.60/3.79 if (index < 0 || index >= size) 10.60/3.79 throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); 10.60/3.79 } 10.60/3.79 10.60/3.79 private void rangeCheckForAdd(int index) { 10.60/3.79 if (index < 0 || index > size) 10.60/3.79 throw new IndexOutOfBoundsException(outOfBoundsMsg(index)); 10.60/3.79 } 10.60/3.79 10.60/3.79 private String outOfBoundsMsg(int index) { 10.60/3.79 return ""; 10.60/3.79 } 10.60/3.79 10.60/3.79 private void checkForComodification() { 10.60/3.79 if (this.modCount != l.modCount) 10.60/3.79 throw new ConcurrentModificationException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 class RandomAccessSubList extends SubList implements RandomAccess { 10.60/3.79 RandomAccessSubList(AbstractList list, int fromIndex, int toIndex) { 10.60/3.79 super(list, fromIndex, toIndex); 10.60/3.79 } 10.60/3.79 10.60/3.79 public List subList(int fromIndex, int toIndex) { 10.60/3.79 return new RandomAccessSubList(this, fromIndex, toIndex); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 /* 10.60/3.79 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.79 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.79 * 10.60/3.79 * This code is free software; you can redistribute it and/or modify it 10.60/3.79 * under the terms of the GNU General Public License version 2 only, as 10.60/3.79 * published by the Free Software Foundation. Sun designates this 10.60/3.79 * particular file as subject to the "Classpath" exception as provided 10.60/3.79 * by Sun in the LICENSE file that accompanied this code. 10.60/3.79 * 10.60/3.79 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.79 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.79 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.79 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.79 * accompanied this code). 10.60/3.79 * 10.60/3.79 * You should have received a copy of the GNU General Public License version 10.60/3.79 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.79 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.79 * 10.60/3.79 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.79 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.79 * have any questions. 10.60/3.79 */ 10.60/3.79 10.60/3.79 package javaUtilEx; 10.60/3.79 10.60/3.79 /** 10.60/3.79 * This class provides a skeletal implementation of the List 10.60/3.79 * interface to minimize the effort required to implement this interface 10.60/3.79 * backed by a "sequential access" data store (such as a linked list). For 10.60/3.79 * random access data (such as an array), AbstractList should be used 10.60/3.79 * in preference to this class.

10.60/3.79 * 10.60/3.79 * This class is the opposite of the AbstractList class in the sense 10.60/3.79 * that it implements the "random access" methods (get(int index), 10.60/3.79 * set(int index, E element), add(int index, E element) and 10.60/3.79 * remove(int index)) on top of the list's list iterator, instead of 10.60/3.79 * the other way around.

10.60/3.79 * 10.60/3.79 * To implement a list the programmer needs only to extend this class and 10.60/3.79 * provide implementations for the listIterator and size 10.60/3.79 * methods. For an unmodifiable list, the programmer need only implement the 10.60/3.79 * list iterator's hasNext, next, hasPrevious, 10.60/3.79 * previous and index methods.

10.60/3.79 * 10.60/3.79 * For a modifiable list the programmer should additionally implement the list 10.60/3.79 * iterator's set method. For a variable-size list the programmer 10.60/3.79 * should additionally implement the list iterator's remove and 10.60/3.79 * add methods.

10.60/3.79 * 10.60/3.79 * The programmer should generally provide a void (no argument) and collection 10.60/3.79 * constructor, as per the recommendation in the Collection interface 10.60/3.79 * specification.

10.60/3.79 * 10.60/3.79 * This class is a member of the 10.60/3.79 * 10.60/3.79 * Java Collections Framework. 10.60/3.79 * 10.60/3.79 * @author Josh Bloch 10.60/3.79 * @author Neal Gafter 10.60/3.79 * @see Collection 10.60/3.79 * @see List 10.60/3.79 * @see AbstractList 10.60/3.79 * @see AbstractCollection 10.60/3.79 * @since 1.2 10.60/3.79 */ 10.60/3.79 10.60/3.79 public abstract class AbstractSequentialList extends AbstractList { 10.60/3.79 /** 10.60/3.79 * Sole constructor. (For invocation by subclass constructors, typically 10.60/3.79 * implicit.) 10.60/3.79 */ 10.60/3.79 protected AbstractSequentialList() { 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns the element at the specified position in this list. 10.60/3.79 * 10.60/3.79 *

This implementation first gets a list iterator pointing to the 10.60/3.79 * indexed element (with listIterator(index)). Then, it gets 10.60/3.79 * the element using ListIterator.next and returns it. 10.60/3.79 * 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public E get(int index) { 10.60/3.79 try { 10.60/3.79 return listIterator(index).next(); 10.60/3.79 } catch (NoSuchElementException exc) { 10.60/3.79 throw new IndexOutOfBoundsException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Replaces the element at the specified position in this list with the 10.60/3.79 * specified element (optional operation). 10.60/3.79 * 10.60/3.79 *

This implementation first gets a list iterator pointing to the 10.60/3.79 * indexed element (with listIterator(index)). Then, it gets 10.60/3.79 * the current element using ListIterator.next and replaces it 10.60/3.79 * with ListIterator.set. 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException if the list iterator does not 10.60/3.79 * implement the set operation. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public E set(int index, E element) { 10.60/3.79 try { 10.60/3.79 ListIterator e = listIterator(index); 10.60/3.79 E oldVal = e.next(); 10.60/3.79 e.set(element); 10.60/3.79 return oldVal; 10.60/3.79 } catch (NoSuchElementException exc) { 10.60/3.79 throw new IndexOutOfBoundsException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Inserts the specified element at the specified position in this list 10.60/3.79 * (optional operation). Shifts the element currently at that position 10.60/3.79 * (if any) and any subsequent elements to the right (adds one to their 10.60/3.79 * indices). 10.60/3.79 * 10.60/3.79 *

This implementation first gets a list iterator pointing to the 10.60/3.79 * indexed element (with listIterator(index)). Then, it 10.60/3.79 * inserts the specified element with ListIterator.add. 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException if the list iterator does not 10.60/3.79 * implement the add operation. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public void add(int index, E element) { 10.60/3.79 try { 10.60/3.79 listIterator(index).add(element); 10.60/3.79 } catch (NoSuchElementException exc) { 10.60/3.79 throw new IndexOutOfBoundsException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Removes the element at the specified position in this list (optional 10.60/3.79 * operation). Shifts any subsequent elements to the left (subtracts one 10.60/3.79 * from their indices). Returns the element that was removed from the 10.60/3.79 * list. 10.60/3.79 * 10.60/3.79 *

This implementation first gets a list iterator pointing to the 10.60/3.79 * indexed element (with listIterator(index)). Then, it removes 10.60/3.79 * the element with ListIterator.remove. 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException if the list iterator does not 10.60/3.79 * implement the remove operation. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public E remove(int index) { 10.60/3.79 try { 10.60/3.79 ListIterator e = listIterator(index); 10.60/3.79 E outCast = e.next(); 10.60/3.79 e.remove(); 10.60/3.79 return outCast; 10.60/3.79 } catch (NoSuchElementException exc) { 10.60/3.79 throw new IndexOutOfBoundsException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 // Bulk Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Inserts all of the elements in the specified collection into this 10.60/3.79 * list at the specified position (optional operation). Shifts the 10.60/3.79 * element currently at that position (if any) and any subsequent 10.60/3.79 * elements to the right (increases their indices). The new elements 10.60/3.79 * will appear in this list in the order that they are returned by the 10.60/3.79 * specified collection's iterator. The behavior of this operation is 10.60/3.79 * undefined if the specified collection is modified while the 10.60/3.79 * operation is in progress. (Note that this will occur if the specified 10.60/3.79 * collection is this list, and it's nonempty.) 10.60/3.79 * 10.60/3.79 *

This implementation gets an iterator over the specified collection and 10.60/3.79 * a list iterator over this list pointing to the indexed element (with 10.60/3.79 * listIterator(index)). Then, it iterates over the specified 10.60/3.79 * collection, inserting the elements obtained from the iterator into this 10.60/3.79 * list, one at a time, using ListIterator.add followed by 10.60/3.79 * ListIterator.next (to skip over the added element). 10.60/3.79 * 10.60/3.79 *

Note that this implementation will throw an 10.60/3.79 * UnsupportedOperationException if the list iterator returned by 10.60/3.79 * the listIterator method does not implement the add 10.60/3.79 * operation. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException {@inheritDoc} 10.60/3.79 * @throws ClassCastException {@inheritDoc} 10.60/3.79 * @throws NullPointerException {@inheritDoc} 10.60/3.79 * @throws IllegalArgumentException {@inheritDoc} 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public boolean addAll(int index, Collection c) { 10.60/3.79 try { 10.60/3.79 boolean modified = false; 10.60/3.79 ListIterator e1 = listIterator(index); 10.60/3.79 Iterator e2 = c.iterator(); 10.60/3.79 while (e2.hasNext()) { 10.60/3.79 e1.add(e2.next()); 10.60/3.79 modified = true; 10.60/3.79 } 10.60/3.79 return modified; 10.60/3.79 } catch (NoSuchElementException exc) { 10.60/3.79 throw new IndexOutOfBoundsException(); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 // Iterators 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns an iterator over the elements in this list (in proper 10.60/3.79 * sequence).

10.60/3.79 * 10.60/3.79 * This implementation merely returns a list iterator over the list. 10.60/3.79 * 10.60/3.79 * @return an iterator over the elements in this list (in proper sequence) 10.60/3.79 */ 10.60/3.79 public Iterator iterator() { 10.60/3.79 return listIterator(); 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns a list iterator over the elements in this list (in proper 10.60/3.79 * sequence). 10.60/3.79 * 10.60/3.79 * @param index index of first element to be returned from the list 10.60/3.79 * iterator (by a call to the next method) 10.60/3.79 * @return a list iterator over the elements in this list (in proper 10.60/3.79 * sequence) 10.60/3.79 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.79 */ 10.60/3.79 public abstract ListIterator listIterator(int index); 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 /* 10.60/3.79 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.79 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.79 * 10.60/3.79 * This code is free software; you can redistribute it and/or modify it 10.60/3.79 * under the terms of the GNU General Public License version 2 only, as 10.60/3.79 * published by the Free Software Foundation. Sun designates this 10.60/3.79 * particular file as subject to the "Classpath" exception as provided 10.60/3.79 * by Sun in the LICENSE file that accompanied this code. 10.60/3.79 * 10.60/3.79 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.79 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.79 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.79 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.79 * accompanied this code). 10.60/3.79 * 10.60/3.79 * You should have received a copy of the GNU General Public License version 10.60/3.79 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.79 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.79 * 10.60/3.79 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.79 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.79 * have any questions. 10.60/3.79 */ 10.60/3.79 10.60/3.79 package javaUtilEx; 10.60/3.79 10.60/3.79 /** 10.60/3.79 * The root interface in the collection hierarchy. A collection 10.60/3.79 * represents a group of objects, known as its elements. Some 10.60/3.79 * collections allow duplicate elements and others do not. Some are ordered 10.60/3.79 * and others unordered. The JDK does not provide any direct 10.60/3.79 * implementations of this interface: it provides implementations of more 10.60/3.79 * specific subinterfaces like Set and List. This interface 10.60/3.79 * is typically used to pass collections around and manipulate them where 10.60/3.79 * maximum generality is desired. 10.60/3.79 * 10.60/3.79 *

Bags or multisets (unordered collections that may contain 10.60/3.79 * duplicate elements) should implement this interface directly. 10.60/3.79 * 10.60/3.79 *

All general-purpose Collection implementation classes (which 10.60/3.79 * typically implement Collection indirectly through one of its 10.60/3.79 * subinterfaces) should provide two "standard" constructors: a void (no 10.60/3.79 * arguments) constructor, which creates an empty collection, and a 10.60/3.79 * constructor with a single argument of type Collection, which 10.60/3.79 * creates a new collection with the same elements as its argument. In 10.60/3.79 * effect, the latter constructor allows the user to copy any collection, 10.60/3.79 * producing an equivalent collection of the desired implementation type. 10.60/3.79 * There is no way to enforce this convention (as interfaces cannot contain 10.60/3.79 * constructors) but all of the general-purpose Collection 10.60/3.79 * implementations in the Java platform libraries comply. 10.60/3.79 * 10.60/3.79 *

The "destructive" methods contained in this interface, that is, the 10.60/3.79 * methods that modify the collection on which they operate, are specified to 10.60/3.79 * throw UnsupportedOperationException if this collection does not 10.60/3.79 * support the operation. If this is the case, these methods may, but are not 10.60/3.79 * required to, throw an UnsupportedOperationException if the 10.60/3.79 * invocation would have no effect on the collection. For example, invoking 10.60/3.79 * the {@link #addAll(Collection)} method on an unmodifiable collection may, 10.60/3.79 * but is not required to, throw the exception if the collection to be added 10.60/3.79 * is empty. 10.60/3.79 * 10.60/3.79 *

Some collection implementations have restrictions on the elements that 10.60/3.79 * they may contain. For example, some implementations prohibit null elements, 10.60/3.79 * and some have restrictions on the types of their elements. Attempting to 10.60/3.79 * add an ineligible element throws an unchecked exception, typically 10.60/3.79 * NullPointerException or ClassCastException. Attempting 10.60/3.79 * to query the presence of an ineligible element may throw an exception, 10.60/3.79 * or it may simply return false; some implementations will exhibit the former 10.60/3.79 * behavior and some will exhibit the latter. More generally, attempting an 10.60/3.79 * operation on an ineligible element whose completion would not result in 10.60/3.79 * the insertion of an ineligible element into the collection may throw an 10.60/3.79 * exception or it may succeed, at the option of the implementation. 10.60/3.79 * Such exceptions are marked as "optional" in the specification for this 10.60/3.79 * interface. 10.60/3.79 * 10.60/3.79 *

It is up to each collection to determine its own synchronization 10.60/3.79 * policy. In the absence of a stronger guarantee by the 10.60/3.79 * implementation, undefined behavior may result from the invocation 10.60/3.79 * of any method on a collection that is being mutated by another 10.60/3.79 * thread; this includes direct invocations, passing the collection to 10.60/3.79 * a method that might perform invocations, and using an existing 10.60/3.79 * iterator to examine the collection. 10.60/3.79 * 10.60/3.79 *

Many methods in Collections Framework interfaces are defined in 10.60/3.79 * terms of the {@link Object#equals(Object) equals} method. For example, 10.60/3.79 * the specification for the {@link #contains(Object) contains(Object o)} 10.60/3.79 * method says: "returns true if and only if this collection 10.60/3.79 * contains at least one element e such that 10.60/3.79 * (o==null ? e==null : o.equals(e))." This specification should 10.60/3.79 * not be construed to imply that invoking Collection.contains 10.60/3.79 * with a non-null argument o will cause o.equals(e) to be 10.60/3.79 * invoked for any element e. Implementations are free to implement 10.60/3.79 * optimizations whereby the equals invocation is avoided, for 10.60/3.79 * example, by first comparing the hash codes of the two elements. (The 10.60/3.79 * {@link Object#hashCode()} specification guarantees that two objects with 10.60/3.79 * unequal hash codes cannot be equal.) More generally, implementations of 10.60/3.79 * the various Collections Framework interfaces are free to take advantage of 10.60/3.79 * the specified behavior of underlying {@link Object} methods wherever the 10.60/3.79 * implementor deems it appropriate. 10.60/3.79 * 10.60/3.79 *

This interface is a member of the 10.60/3.79 * 10.60/3.79 * Java Collections Framework. 10.60/3.79 * 10.60/3.79 * @author Josh Bloch 10.60/3.79 * @author Neal Gafter 10.60/3.79 * @see Set 10.60/3.79 * @see List 10.60/3.79 * @see Map 10.60/3.79 * @see SortedSet 10.60/3.79 * @see SortedMap 10.60/3.79 * @see HashSet 10.60/3.79 * @see TreeSet 10.60/3.79 * @see ArrayList 10.60/3.79 * @see LinkedList 10.60/3.79 * @see Vector 10.60/3.79 * @see Collections 10.60/3.79 * @see Arrays 10.60/3.79 * @see AbstractCollection 10.60/3.79 * @since 1.2 10.60/3.79 */ 10.60/3.79 10.60/3.79 public interface Collection { 10.60/3.79 // Query Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns the number of elements in this collection. If this collection 10.60/3.79 * contains more than Integer.MAX_VALUE elements, returns 10.60/3.79 * Integer.MAX_VALUE. 10.60/3.79 * 10.60/3.79 * @return the number of elements in this collection 10.60/3.79 */ 10.60/3.79 int size(); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns true if this collection contains no elements. 10.60/3.79 * 10.60/3.79 * @return true if this collection contains no elements 10.60/3.79 */ 10.60/3.79 boolean isEmpty(); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns true if this collection contains the specified element. 10.60/3.79 * More formally, returns true if and only if this collection 10.60/3.79 * contains at least one element e such that 10.60/3.79 * (o==null ? e==null : o.equals(e)). 10.60/3.79 * 10.60/3.79 * @param o element whose presence in this collection is to be tested 10.60/3.79 * @return true if this collection contains the specified 10.60/3.79 * element 10.60/3.79 * @throws ClassCastException if the type of the specified element 10.60/3.79 * is incompatible with this collection (optional) 10.60/3.79 * @throws NullPointerException if the specified element is null and this 10.60/3.79 * collection does not permit null elements (optional) 10.60/3.79 */ 10.60/3.79 boolean contains(Object o); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns an iterator over the elements in this collection. There are no 10.60/3.79 * guarantees concerning the order in which the elements are returned 10.60/3.79 * (unless this collection is an instance of some class that provides a 10.60/3.79 * guarantee). 10.60/3.79 * 10.60/3.79 * @return an Iterator over the elements in this collection 10.60/3.79 */ 10.60/3.79 Iterator iterator(); 10.60/3.79 10.60/3.79 // Modification Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Ensures that this collection contains the specified element (optional 10.60/3.79 * operation). Returns true if this collection changed as a 10.60/3.79 * result of the call. (Returns false if this collection does 10.60/3.79 * not permit duplicates and already contains the specified element.)

10.60/3.79 * 10.60/3.79 * Collections that support this operation may place limitations on what 10.60/3.79 * elements may be added to this collection. In particular, some 10.60/3.79 * collections will refuse to add null elements, and others will 10.60/3.79 * impose restrictions on the type of elements that may be added. 10.60/3.79 * Collection classes should clearly specify in their documentation any 10.60/3.79 * restrictions on what elements may be added.

10.60/3.79 * 10.60/3.79 * If a collection refuses to add a particular element for any reason 10.60/3.79 * other than that it already contains the element, it must throw 10.60/3.79 * an exception (rather than returning false). This preserves 10.60/3.79 * the invariant that a collection always contains the specified element 10.60/3.79 * after this call returns. 10.60/3.79 * 10.60/3.79 * @param e element whose presence in this collection is to be ensured 10.60/3.79 * @return true if this collection changed as a result of the 10.60/3.79 * call 10.60/3.79 * @throws UnsupportedOperationException if the add operation 10.60/3.79 * is not supported by this collection 10.60/3.79 * @throws ClassCastException if the class of the specified element 10.60/3.79 * prevents it from being added to this collection 10.60/3.79 * @throws NullPointerException if the specified element is null and this 10.60/3.79 * collection does not permit null elements 10.60/3.79 * @throws IllegalArgumentException if some property of the element 10.60/3.79 * prevents it from being added to this collection 10.60/3.79 * @throws IllegalStateException if the element cannot be added at this 10.60/3.79 * time due to insertion restrictions 10.60/3.79 */ 10.60/3.79 boolean add(E e); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Removes a single instance of the specified element from this 10.60/3.79 * collection, if it is present (optional operation). More formally, 10.60/3.79 * removes an element e such that 10.60/3.79 * (o==null ? e==null : o.equals(e)), if 10.60/3.79 * this collection contains one or more such elements. Returns 10.60/3.79 * true if this collection contained the specified element (or 10.60/3.79 * equivalently, if this collection changed as a result of the call). 10.60/3.79 * 10.60/3.79 * @param o element to be removed from this collection, if present 10.60/3.79 * @return true if an element was removed as a result of this call 10.60/3.79 * @throws ClassCastException if the type of the specified element 10.60/3.79 * is incompatible with this collection (optional) 10.60/3.79 * @throws NullPointerException if the specified element is null and this 10.60/3.79 * collection does not permit null elements (optional) 10.60/3.79 * @throws UnsupportedOperationException if the remove operation 10.60/3.79 * is not supported by this collection 10.60/3.79 */ 10.60/3.79 boolean remove(Object o); 10.60/3.79 10.60/3.79 10.60/3.79 // Bulk Operations 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns true if this collection contains all of the elements 10.60/3.79 * in the specified collection. 10.60/3.79 * 10.60/3.79 * @param c collection to be checked for containment in this collection 10.60/3.79 * @return true if this collection contains all of the elements 10.60/3.79 * in the specified collection 10.60/3.79 * @throws ClassCastException if the types of one or more elements 10.60/3.79 * in the specified collection are incompatible with this 10.60/3.79 * collection (optional) 10.60/3.79 * @throws NullPointerException if the specified collection contains one 10.60/3.79 * or more null elements and this collection does not permit null 10.60/3.79 * elements (optional), or if the specified collection is null 10.60/3.79 * @see #contains(Object) 10.60/3.79 */ 10.60/3.79 boolean containsAll(Collection c); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Adds all of the elements in the specified collection to this collection 10.60/3.79 * (optional operation). The behavior of this operation is undefined if 10.60/3.79 * the specified collection is modified while the operation is in progress. 10.60/3.79 * (This implies that the behavior of this call is undefined if the 10.60/3.79 * specified collection is this collection, and this collection is 10.60/3.79 * nonempty.) 10.60/3.79 * 10.60/3.79 * @param c collection containing elements to be added to this collection 10.60/3.79 * @return true if this collection changed as a result of the call 10.60/3.79 * @throws UnsupportedOperationException if the addAll operation 10.60/3.79 * is not supported by this collection 10.60/3.79 * @throws ClassCastException if the class of an element of the specified 10.60/3.79 * collection prevents it from being added to this collection 10.60/3.79 * @throws NullPointerException if the specified collection contains a 10.60/3.79 * null element and this collection does not permit null elements, 10.60/3.79 * or if the specified collection is null 10.60/3.79 * @throws IllegalArgumentException if some property of an element of the 10.60/3.79 * specified collection prevents it from being added to this 10.60/3.79 * collection 10.60/3.79 * @throws IllegalStateException if not all the elements can be added at 10.60/3.79 * this time due to insertion restrictions 10.60/3.79 * @see #add(Object) 10.60/3.79 */ 10.60/3.79 boolean addAll(Collection c); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Removes all of this collection's elements that are also contained in the 10.60/3.79 * specified collection (optional operation). After this call returns, 10.60/3.79 * this collection will contain no elements in common with the specified 10.60/3.79 * collection. 10.60/3.79 * 10.60/3.79 * @param c collection containing elements to be removed from this collection 10.60/3.79 * @return true if this collection changed as a result of the 10.60/3.79 * call 10.60/3.79 * @throws UnsupportedOperationException if the removeAll method 10.60/3.79 * is not supported by this collection 10.60/3.79 * @throws ClassCastException if the types of one or more elements 10.60/3.79 * in this collection are incompatible with the specified 10.60/3.79 * collection (optional) 10.60/3.79 * @throws NullPointerException if this collection contains one or more 10.60/3.79 * null elements and the specified collection does not support 10.60/3.79 * null elements (optional), or if the specified collection is null 10.60/3.79 * @see #remove(Object) 10.60/3.79 * @see #contains(Object) 10.60/3.79 */ 10.60/3.79 boolean removeAll(Collection c); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Retains only the elements in this collection that are contained in the 10.60/3.79 * specified collection (optional operation). In other words, removes from 10.60/3.79 * this collection all of its elements that are not contained in the 10.60/3.79 * specified collection. 10.60/3.79 * 10.60/3.79 * @param c collection containing elements to be retained in this collection 10.60/3.79 * @return true if this collection changed as a result of the call 10.60/3.79 * @throws UnsupportedOperationException if the retainAll operation 10.60/3.79 * is not supported by this collection 10.60/3.79 * @throws ClassCastException if the types of one or more elements 10.60/3.79 * in this collection are incompatible with the specified 10.60/3.79 * collection (optional) 10.60/3.79 * @throws NullPointerException if this collection contains one or more 10.60/3.79 * null elements and the specified collection does not permit null 10.60/3.79 * elements (optional), or if the specified collection is null 10.60/3.79 * @see #remove(Object) 10.60/3.79 * @see #contains(Object) 10.60/3.79 */ 10.60/3.79 boolean retainAll(Collection c); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Removes all of the elements from this collection (optional operation). 10.60/3.79 * The collection will be empty after this method returns. 10.60/3.79 * 10.60/3.79 * @throws UnsupportedOperationException if the clear operation 10.60/3.79 * is not supported by this collection 10.60/3.79 */ 10.60/3.79 void clear(); 10.60/3.79 10.60/3.79 10.60/3.79 // Comparison and hashing 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Compares the specified object with this collection for equality.

10.60/3.79 * 10.60/3.79 * While the Collection interface adds no stipulations to the 10.60/3.79 * general contract for the Object.equals, programmers who 10.60/3.79 * implement the Collection interface "directly" (in other words, 10.60/3.79 * create a class that is a Collection but is not a Set 10.60/3.79 * or a List) must exercise care if they choose to override the 10.60/3.79 * Object.equals. It is not necessary to do so, and the simplest 10.60/3.79 * course of action is to rely on Object's implementation, but 10.60/3.79 * the implementor may wish to implement a "value comparison" in place of 10.60/3.79 * the default "reference comparison." (The List and 10.60/3.79 * Set interfaces mandate such value comparisons.)

10.60/3.79 * 10.60/3.79 * The general contract for the Object.equals method states that 10.60/3.79 * equals must be symmetric (in other words, a.equals(b) if and 10.60/3.79 * only if b.equals(a)). The contracts for List.equals 10.60/3.79 * and Set.equals state that lists are only equal to other lists, 10.60/3.79 * and sets to other sets. Thus, a custom equals method for a 10.60/3.79 * collection class that implements neither the List nor 10.60/3.79 * Set interface must return false when this collection 10.60/3.79 * is compared to any list or set. (By the same logic, it is not possible 10.60/3.79 * to write a class that correctly implements both the Set and 10.60/3.79 * List interfaces.) 10.60/3.79 * 10.60/3.79 * @param o object to be compared for equality with this collection 10.60/3.79 * @return true if the specified object is equal to this 10.60/3.79 * collection 10.60/3.79 * 10.60/3.79 * @see Object#equals(Object) 10.60/3.79 * @see Set#equals(Object) 10.60/3.79 * @see List#equals(Object) 10.60/3.79 */ 10.60/3.79 boolean equals(Object o); 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Returns the hash code value for this collection. While the 10.60/3.79 * Collection interface adds no stipulations to the general 10.60/3.79 * contract for the Object.hashCode method, programmers should 10.60/3.79 * take note that any class that overrides the Object.equals 10.60/3.79 * method must also override the Object.hashCode method in order 10.60/3.79 * to satisfy the general contract for the Object.hashCodemethod. 10.60/3.79 * In particular, c1.equals(c2) implies that 10.60/3.79 * c1.hashCode()==c2.hashCode(). 10.60/3.79 * 10.60/3.79 * @return the hash code value for this collection 10.60/3.79 * 10.60/3.79 * @see Object#hashCode() 10.60/3.79 * @see Object#equals(Object) 10.60/3.79 */ 10.60/3.79 int hashCode(); 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 /* 10.60/3.79 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.79 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.79 * 10.60/3.79 * This code is free software; you can redistribute it and/or modify it 10.60/3.79 * under the terms of the GNU General Public License version 2 only, as 10.60/3.79 * published by the Free Software Foundation. Sun designates this 10.60/3.79 * particular file as subject to the "Classpath" exception as provided 10.60/3.79 * by Sun in the LICENSE file that accompanied this code. 10.60/3.79 * 10.60/3.79 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.79 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.79 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.79 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.79 * accompanied this code). 10.60/3.79 * 10.60/3.79 * You should have received a copy of the GNU General Public License version 10.60/3.79 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.79 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.79 * 10.60/3.79 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.79 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.79 * have any questions. 10.60/3.79 */ 10.60/3.79 10.60/3.79 package javaUtilEx; 10.60/3.79 10.60/3.79 /** 10.60/3.79 * This exception may be thrown by methods that have detected concurrent 10.60/3.79 * modification of an object when such modification is not permissible. 10.60/3.79 *

10.60/3.79 * For example, it is not generally permissible for one thread to modify a Collection 10.60/3.79 * while another thread is iterating over it. In general, the results of the 10.60/3.79 * iteration are undefined under these circumstances. Some Iterator 10.60/3.79 * implementations (including those of all the general purpose collection implementations 10.60/3.79 * provided by the JRE) may choose to throw this exception if this behavior is 10.60/3.79 * detected. Iterators that do this are known as fail-fast iterators, 10.60/3.79 * as they fail quickly and cleanly, rather that risking arbitrary, 10.60/3.79 * non-deterministic behavior at an undetermined time in the future. 10.60/3.79 *

10.60/3.79 * Note that this exception does not always indicate that an object has 10.60/3.79 * been concurrently modified by a different thread. If a single 10.60/3.79 * thread issues a sequence of method invocations that violates the 10.60/3.79 * contract of an object, the object may throw this exception. For 10.60/3.79 * example, if a thread modifies a collection directly while it is 10.60/3.79 * iterating over the collection with a fail-fast iterator, the iterator 10.60/3.79 * will throw this exception. 10.60/3.79 * 10.60/3.79 *

Note that fail-fast behavior cannot be guaranteed as it is, generally 10.60/3.79 * speaking, impossible to make any hard guarantees in the presence of 10.60/3.79 * unsynchronized concurrent modification. Fail-fast operations 10.60/3.79 * throw ConcurrentModificationException on a best-effort basis. 10.60/3.79 * Therefore, it would be wrong to write a program that depended on this 10.60/3.79 * exception for its correctness: ConcurrentModificationException 10.60/3.79 * should be used only to detect bugs. 10.60/3.79 * 10.60/3.79 * @author Josh Bloch 10.60/3.79 * @see Collection 10.60/3.79 * @see Iterator 10.60/3.79 * @see ListIterator 10.60/3.79 * @see Vector 10.60/3.79 * @see LinkedList 10.60/3.79 * @see HashSet 10.60/3.79 * @see Hashtable 10.60/3.79 * @see TreeMap 10.60/3.79 * @see AbstractList 10.60/3.79 * @since 1.2 10.60/3.79 */ 10.60/3.79 public class ConcurrentModificationException extends RuntimeException { 10.60/3.79 /** 10.60/3.79 * Constructs a ConcurrentModificationException with no 10.60/3.79 * detail message. 10.60/3.79 */ 10.60/3.79 public ConcurrentModificationException() { 10.60/3.79 } 10.60/3.79 10.60/3.79 /** 10.60/3.79 * Constructs a ConcurrentModificationException with the 10.60/3.79 * specified detail message. 10.60/3.79 * 10.60/3.79 * @param message the detail message pertaining to this exception. 10.60/3.79 */ 10.60/3.79 public ConcurrentModificationException(String message) { 10.60/3.79 super(message); 10.60/3.79 } 10.60/3.79 } 10.60/3.79 10.60/3.79 10.60/3.79 /* 10.60/3.79 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.79 * 10.60/3.79 * This code is free software; you can redistribute it and/or modify it 10.60/3.79 * under the terms of the GNU General Public License version 2 only, as 10.60/3.79 * published by the Free Software Foundation. Sun designates this 10.60/3.79 * particular file as subject to the "Classpath" exception as provided 10.60/3.79 * by Sun in the LICENSE file that accompanied this code. 10.60/3.79 * 10.60/3.79 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.79 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.79 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.79 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.79 * accompanied this code). 10.60/3.79 * 10.60/3.79 * You should have received a copy of the GNU General Public License version 10.60/3.79 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.79 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.79 * 10.60/3.79 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.79 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.79 * have any questions. 10.60/3.79 */ 10.60/3.79 10.60/3.79 /* 10.60/3.79 * This file is available under and governed by the GNU General Public 10.60/3.79 * License version 2 only, as published by the Free Software Foundation. 10.60/3.79 * However, the following notice accompanied the original version of this 10.60/3.79 * file: 10.60/3.79 * 10.60/3.79 * Written by Doug Lea and Josh Bloch with assistance from members of 10.60/3.79 * JCP JSR-166 Expert Group and released to the public domain, as explained 10.60/3.79 * at http://creativecommons.org/licenses/publicdomain 10.60/3.79 */ 10.60/3.79 10.60/3.79 package javaUtilEx; 10.60/3.79 10.60/3.79 /** 10.60/3.79 * A linear collection that supports element insertion and removal at 10.60/3.79 * both ends. The name deque is short for "double ended queue" 10.60/3.79 * and is usually pronounced "deck". Most Deque 10.60/3.79 * implementations place no fixed limits on the number of elements 10.60/3.79 * they may contain, but this interface supports capacity-restricted 10.60/3.79 * deques as well as those with no fixed size limit. 10.60/3.79 * 10.60/3.79 *

This interface defines methods to access the elements at both 10.60/3.79 * ends of the deque. Methods are provided to insert, remove, and 10.60/3.79 * examine the element. Each of these methods exists in two forms: 10.60/3.79 * one throws an exception if the operation fails, the other returns a 10.60/3.79 * special value (either null or false, depending on 10.60/3.79 * the operation). The latter form of the insert operation is 10.60/3.79 * designed specifically for use with capacity-restricted 10.60/3.79 * Deque implementations; in most implementations, insert 10.60/3.79 * operations cannot fail. 10.60/3.79 * 10.60/3.79 *

The twelve methods described above are summarized in the 10.60/3.79 * following table: 10.60/3.79 * 10.60/3.79 *

10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 *
First Element (Head) Last Element (Tail)
Throws exceptionSpecial valueThrows exceptionSpecial value
Insert{@link #addFirst addFirst(e)}{@link #offerFirst offerFirst(e)}{@link #addLast addLast(e)}{@link #offerLast offerLast(e)}
Remove{@link #removeFirst removeFirst()}{@link #pollFirst pollFirst()}{@link #removeLast removeLast()}{@link #pollLast pollLast()}
Examine{@link #getFirst getFirst()}{@link #peekFirst peekFirst()}{@link #getLast getLast()}{@link #peekLast peekLast()}
10.60/3.79 * 10.60/3.79 *

This interface extends the {@link Queue} interface. When a deque is 10.60/3.79 * used as a queue, FIFO (First-In-First-Out) behavior results. Elements are 10.60/3.79 * added at the end of the deque and removed from the beginning. The methods 10.60/3.79 * inherited from the Queue interface are precisely equivalent to 10.60/3.79 * Deque methods as indicated in the following table: 10.60/3.79 * 10.60/3.79 *

10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 *
Queue Method Equivalent Deque Method
{@link java.util.Queue#add add(e)}{@link #addLast addLast(e)}
{@link java.util.Queue#offer offer(e)}{@link #offerLast offerLast(e)}
{@link java.util.Queue#remove remove()}{@link #removeFirst removeFirst()}
{@link java.util.Queue#poll poll()}{@link #pollFirst pollFirst()}
{@link java.util.Queue#element element()}{@link #getFirst getFirst()}
{@link java.util.Queue#peek peek()}{@link #peek peekFirst()}
10.60/3.79 * 10.60/3.79 *

Deques can also be used as LIFO (Last-In-First-Out) stacks. This 10.60/3.79 * interface should be used in preference to the legacy {@link Stack} class. 10.60/3.79 * When a deque is used as a stack, elements are pushed and popped from the 10.60/3.79 * beginning of the deque. Stack methods are precisely equivalent to 10.60/3.79 * Deque methods as indicated in the table below: 10.60/3.79 * 10.60/3.79 *

10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 * 10.60/3.79 *
Stack Method Equivalent Deque Method
{@link #push push(e)}{@link #addFirst addFirst(e)}
{@link #pop pop()}{@link #removeFirst removeFirst()}
{@link #peek peek()}{@link #peekFirst peekFirst()}
10.60/3.79 * 10.60/3.79 *

Note that the {@link #peek peek} method works equally well when 10.60/3.79 * a deque is used as a queue or a stack; in either case, elements are 10.60/3.79 * drawn from the beginning of the deque. 10.60/3.79 * 10.60/3.79 *

This interface provides two methods to remove interior 10.60/3.79 * elements, {@link #removeFirstOccurrence removeFirstOccurrence} and 10.60/3.79 * {@link #removeLastOccurrence removeLastOccurrence}. 10.60/3.79 * 10.60/3.79 *

Unlike the {@link List} interface, this interface does not 10.60/3.79 * provide support for indexed access to elements. 10.60/3.79 * 10.60/3.79 *

While Deque implementations are not strictly required 10.60/3.79 * to prohibit the insertion of null elements, they are strongly 10.60/3.79 * encouraged to do so. Users of any Deque implementations 10.60/3.79 * that do allow null elements are strongly encouraged not to 10.60/3.79 * take advantage of the ability to insert nulls. This is so because 10.60/3.79 * null is used as a special return value by various methods 10.60/3.79 * to indicated that the deque is empty. 10.60/3.79 * 10.60/3.79 *

Deque implementations generally do not define 10.60/3.79 * element-based versions of the equals and hashCode 10.60/3.79 * methods, but instead inherit the identity-based versions from class 10.60/3.79 * Object. 10.60/3.79 * 10.60/3.79 *

This interface is a member of the Java Collections 10.60/3.79 * Framework. 10.60/3.79 * 10.60/3.79 * @author Doug Lea 10.60/3.79 * @author Josh Bloch 10.60/3.79 * @since 1.6 10.60/3.79 * @param the type of elements held in this collection 10.60/3.79 */ 10.60/3.79 10.60/3.79 public interface Deque extends Queue { 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the front of this deque if it is 10.60/3.80 * possible to do so immediately without violating capacity restrictions. 10.60/3.80 * When using a capacity-restricted deque, it is generally preferable to 10.60/3.80 * use method {@link #offerFirst}. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 * @throws IllegalStateException if the element cannot be added at this 10.60/3.80 * time due to capacity restrictions 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this deque 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of the specified 10.60/3.80 * element prevents it from being added to this deque 10.60/3.80 */ 10.60/3.80 void addFirst(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the end of this deque if it is 10.60/3.80 * possible to do so immediately without violating capacity restrictions. 10.60/3.80 * When using a capacity-restricted deque, it is generally preferable to 10.60/3.80 * use method {@link #offerLast}. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #add}. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 * @throws IllegalStateException if the element cannot be added at this 10.60/3.80 * time due to capacity restrictions 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this deque 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of the specified 10.60/3.80 * element prevents it from being added to this deque 10.60/3.80 */ 10.60/3.80 void addLast(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the front of this deque unless it would 10.60/3.80 * violate capacity restrictions. When using a capacity-restricted deque, 10.60/3.80 * this method is generally preferable to the {@link #addFirst} method, 10.60/3.80 * which can fail to insert an element only by throwing an exception. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 * @return true if the element was added to this deque, else 10.60/3.80 * false 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this deque 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of the specified 10.60/3.80 * element prevents it from being added to this deque 10.60/3.80 */ 10.60/3.80 boolean offerFirst(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the end of this deque unless it would 10.60/3.80 * violate capacity restrictions. When using a capacity-restricted deque, 10.60/3.80 * this method is generally preferable to the {@link #addLast} method, 10.60/3.80 * which can fail to insert an element only by throwing an exception. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 * @return true if the element was added to this deque, else 10.60/3.80 * false 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this deque 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of the specified 10.60/3.80 * element prevents it from being added to this deque 10.60/3.80 */ 10.60/3.80 boolean offerLast(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the first element of this deque. This method 10.60/3.80 * differs from {@link #pollFirst pollFirst} only in that it throws an 10.60/3.80 * exception if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the head of this deque 10.60/3.80 * @throws NoSuchElementException if this deque is empty 10.60/3.80 */ 10.60/3.80 E removeFirst(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the last element of this deque. This method 10.60/3.80 * differs from {@link #pollLast pollLast} only in that it throws an 10.60/3.80 * exception if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the tail of this deque 10.60/3.80 * @throws NoSuchElementException if this deque is empty 10.60/3.80 */ 10.60/3.80 E removeLast(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the first element of this deque, 10.60/3.80 * or returns null if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the head of this deque, or null if this deque is empty 10.60/3.80 */ 10.60/3.80 E pollFirst(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the last element of this deque, 10.60/3.80 * or returns null if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the tail of this deque, or null if this deque is empty 10.60/3.80 */ 10.60/3.80 E pollLast(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the first element of this deque. 10.60/3.80 * 10.60/3.80 * This method differs from {@link #peekFirst peekFirst} only in that it 10.60/3.80 * throws an exception if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the head of this deque 10.60/3.80 * @throws NoSuchElementException if this deque is empty 10.60/3.80 */ 10.60/3.80 E getFirst(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the last element of this deque. 10.60/3.80 * This method differs from {@link #peekLast peekLast} only in that it 10.60/3.80 * throws an exception if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the tail of this deque 10.60/3.80 * @throws NoSuchElementException if this deque is empty 10.60/3.80 */ 10.60/3.80 E getLast(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the first element of this deque, 10.60/3.80 * or returns null if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the head of this deque, or null if this deque is empty 10.60/3.80 */ 10.60/3.80 E peekFirst(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the last element of this deque, 10.60/3.80 * or returns null if this deque is empty. 10.60/3.80 * 10.60/3.80 * @return the tail of this deque, or null if this deque is empty 10.60/3.80 */ 10.60/3.80 E peekLast(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the first occurrence of the specified element from this deque. 10.60/3.80 * If the deque does not contain the element, it is unchanged. 10.60/3.80 * More formally, removes the first element e such that 10.60/3.80 * (o==null ? e==null : o.equals(e)) 10.60/3.80 * (if such an element exists). 10.60/3.80 * Returns true if this deque contained the specified element 10.60/3.80 * (or equivalently, if this deque changed as a result of the call). 10.60/3.80 * 10.60/3.80 * @param o element to be removed from this deque, if present 10.60/3.80 * @return true if an element was removed as a result of this call 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * is incompatible with this deque (optional) 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements (optional) 10.60/3.80 */ 10.60/3.80 boolean removeFirstOccurrence(Object o); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the last occurrence of the specified element from this deque. 10.60/3.80 * If the deque does not contain the element, it is unchanged. 10.60/3.80 * More formally, removes the last element e such that 10.60/3.80 * (o==null ? e==null : o.equals(e)) 10.60/3.80 * (if such an element exists). 10.60/3.80 * Returns true if this deque contained the specified element 10.60/3.80 * (or equivalently, if this deque changed as a result of the call). 10.60/3.80 * 10.60/3.80 * @param o element to be removed from this deque, if present 10.60/3.80 * @return true if an element was removed as a result of this call 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * is incompatible with this deque (optional) 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements (optional) 10.60/3.80 */ 10.60/3.80 boolean removeLastOccurrence(Object o); 10.60/3.80 10.60/3.80 // *** Queue methods *** 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element into the queue represented by this deque 10.60/3.80 * (in other words, at the tail of this deque) if it is possible to do so 10.60/3.80 * immediately without violating capacity restrictions, returning 10.60/3.80 * true upon success and throwing an 10.60/3.80 * IllegalStateException if no space is currently available. 10.60/3.80 * When using a capacity-restricted deque, it is generally preferable to 10.60/3.80 * use {@link #offer(Object) offer}. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #addLast}. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 * @return true (as specified by {@link Collection#add}) 10.60/3.80 * @throws IllegalStateException if the element cannot be added at this 10.60/3.80 * time due to capacity restrictions 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this deque 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of the specified 10.60/3.80 * element prevents it from being added to this deque 10.60/3.80 */ 10.60/3.80 boolean add(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element into the queue represented by this deque 10.60/3.80 * (in other words, at the tail of this deque) if it is possible to do so 10.60/3.80 * immediately without violating capacity restrictions, returning 10.60/3.80 * true upon success and false if no space is currently 10.60/3.80 * available. When using a capacity-restricted deque, this method is 10.60/3.80 * generally preferable to the {@link #add} method, which can fail to 10.60/3.80 * insert an element only by throwing an exception. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #offerLast}. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 * @return true if the element was added to this deque, else 10.60/3.80 * false 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this deque 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of the specified 10.60/3.80 * element prevents it from being added to this deque 10.60/3.80 */ 10.60/3.80 boolean offer(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the head of the queue represented by this deque 10.60/3.80 * (in other words, the first element of this deque). 10.60/3.80 * This method differs from {@link #poll poll} only in that it throws an 10.60/3.80 * exception if this deque is empty. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #removeFirst()}. 10.60/3.80 * 10.60/3.80 * @return the head of the queue represented by this deque 10.60/3.80 * @throws NoSuchElementException if this deque is empty 10.60/3.80 */ 10.60/3.80 E remove(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the head of the queue represented by this deque 10.60/3.80 * (in other words, the first element of this deque), or returns 10.60/3.80 * null if this deque is empty. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #pollFirst()}. 10.60/3.80 * 10.60/3.80 * @return the first element of this deque, or null if 10.60/3.80 * this deque is empty 10.60/3.80 */ 10.60/3.80 E poll(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the head of the queue represented by 10.60/3.80 * this deque (in other words, the first element of this deque). 10.60/3.80 * This method differs from {@link #peek peek} only in that it throws an 10.60/3.80 * exception if this deque is empty. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #getFirst()}. 10.60/3.80 * 10.60/3.80 * @return the head of the queue represented by this deque 10.60/3.80 * @throws NoSuchElementException if this deque is empty 10.60/3.80 */ 10.60/3.80 E element(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the head of the queue represented by 10.60/3.80 * this deque (in other words, the first element of this deque), or 10.60/3.80 * returns null if this deque is empty. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #peekFirst()}. 10.60/3.80 * 10.60/3.80 * @return the head of the queue represented by this deque, or 10.60/3.80 * null if this deque is empty 10.60/3.80 */ 10.60/3.80 E peek(); 10.60/3.80 10.60/3.80 10.60/3.80 // *** Stack methods *** 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Pushes an element onto the stack represented by this deque (in other 10.60/3.80 * words, at the head of this deque) if it is possible to do so 10.60/3.80 * immediately without violating capacity restrictions, returning 10.60/3.80 * true upon success and throwing an 10.60/3.80 * IllegalStateException if no space is currently available. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #addFirst}. 10.60/3.80 * 10.60/3.80 * @param e the element to push 10.60/3.80 * @throws IllegalStateException if the element cannot be added at this 10.60/3.80 * time due to capacity restrictions 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this deque 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of the specified 10.60/3.80 * element prevents it from being added to this deque 10.60/3.80 */ 10.60/3.80 void push(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Pops an element from the stack represented by this deque. In other 10.60/3.80 * words, removes and returns the first element of this deque. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #removeFirst()}. 10.60/3.80 * 10.60/3.80 * @return the element at the front of this deque (which is the top 10.60/3.80 * of the stack represented by this deque) 10.60/3.80 * @throws NoSuchElementException if this deque is empty 10.60/3.80 */ 10.60/3.80 E pop(); 10.60/3.80 10.60/3.80 10.60/3.80 // *** Collection methods *** 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the first occurrence of the specified element from this deque. 10.60/3.80 * If the deque does not contain the element, it is unchanged. 10.60/3.80 * More formally, removes the first element e such that 10.60/3.80 * (o==null ? e==null : o.equals(e)) 10.60/3.80 * (if such an element exists). 10.60/3.80 * Returns true if this deque contained the specified element 10.60/3.80 * (or equivalently, if this deque changed as a result of the call). 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #removeFirstOccurrence}. 10.60/3.80 * 10.60/3.80 * @param o element to be removed from this deque, if present 10.60/3.80 * @return true if an element was removed as a result of this call 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * is incompatible with this deque (optional) 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements (optional) 10.60/3.80 */ 10.60/3.80 boolean remove(Object o); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns true if this deque contains the specified element. 10.60/3.80 * More formally, returns true if and only if this deque contains 10.60/3.80 * at least one element e such that 10.60/3.80 * (o==null ? e==null : o.equals(e)). 10.60/3.80 * 10.60/3.80 * @param o element whose presence in this deque is to be tested 10.60/3.80 * @return true if this deque contains the specified element 10.60/3.80 * @throws ClassCastException if the type of the specified element 10.60/3.80 * is incompatible with this deque (optional) 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * deque does not permit null elements (optional) 10.60/3.80 */ 10.60/3.80 boolean contains(Object o); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the number of elements in this deque. 10.60/3.80 * 10.60/3.80 * @return the number of elements in this deque 10.60/3.80 */ 10.60/3.80 public int size(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns an iterator over the elements in this deque in proper sequence. 10.60/3.80 * The elements will be returned in order from first (head) to last (tail). 10.60/3.80 * 10.60/3.80 * @return an iterator over the elements in this deque in proper sequence 10.60/3.80 */ 10.60/3.80 Iterator iterator(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns an iterator over the elements in this deque in reverse 10.60/3.80 * sequential order. The elements will be returned in order from 10.60/3.80 * last (tail) to first (head). 10.60/3.80 * 10.60/3.80 * @return an iterator over the elements in this deque in reverse 10.60/3.80 * sequence 10.60/3.80 */ 10.60/3.80 Iterator descendingIterator(); 10.60/3.80 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 /* 10.60/3.80 * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.80 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.80 * 10.60/3.80 * This code is free software; you can redistribute it and/or modify it 10.60/3.80 * under the terms of the GNU General Public License version 2 only, as 10.60/3.80 * published by the Free Software Foundation. Sun designates this 10.60/3.80 * particular file as subject to the "Classpath" exception as provided 10.60/3.80 * by Sun in the LICENSE file that accompanied this code. 10.60/3.80 * 10.60/3.80 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.80 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.80 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.80 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.80 * accompanied this code). 10.60/3.80 * 10.60/3.80 * You should have received a copy of the GNU General Public License version 10.60/3.80 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.80 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.80 * 10.60/3.80 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.80 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.80 * have any questions. 10.60/3.80 */ 10.60/3.80 10.60/3.80 package javaUtilEx; 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Thrown to indicate that a method has been passed an illegal or 10.60/3.80 * inappropriate argument. 10.60/3.80 * 10.60/3.80 * @author unascribed 10.60/3.80 * @see java.lang.Thread#setPriority(int) 10.60/3.80 * @since JDK1.0 10.60/3.80 */ 10.60/3.80 public 10.60/3.80 class IllegalArgumentException extends RuntimeException { 10.60/3.80 /** 10.60/3.80 * Constructs an IllegalArgumentException with no 10.60/3.80 * detail message. 10.60/3.80 */ 10.60/3.80 public IllegalArgumentException() { 10.60/3.80 super(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs an IllegalArgumentException with the 10.60/3.80 * specified detail message. 10.60/3.80 * 10.60/3.80 * @param s the detail message. 10.60/3.80 */ 10.60/3.80 public IllegalArgumentException(String s) { 10.60/3.80 super(s); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs a new exception with the specified detail message and 10.60/3.80 * cause. 10.60/3.80 * 10.60/3.80 *

Note that the detail message associated with cause is 10.60/3.80 * not automatically incorporated in this exception's detail 10.60/3.80 * message. 10.60/3.80 * 10.60/3.80 * @param message the detail message (which is saved for later retrieval 10.60/3.80 * by the {@link Throwable#getMessage()} method). 10.60/3.80 * @param cause the cause (which is saved for later retrieval by the 10.60/3.80 * {@link Throwable#getCause()} method). (A null value 10.60/3.80 * is permitted, and indicates that the cause is nonexistent or 10.60/3.80 * unknown.) 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public IllegalArgumentException(String message, Throwable cause) { 10.60/3.80 super(message, cause); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs a new exception with the specified cause and a detail 10.60/3.80 * message of (cause==null ? null : cause.toString()) (which 10.60/3.80 * typically contains the class and detail message of cause). 10.60/3.80 * This constructor is useful for exceptions that are little more than 10.60/3.80 * wrappers for other throwables (for example, {@link 10.60/3.80 * java.security.PrivilegedActionException}). 10.60/3.80 * 10.60/3.80 * @param cause the cause (which is saved for later retrieval by the 10.60/3.80 * {@link Throwable#getCause()} method). (A null value is 10.60/3.80 * permitted, and indicates that the cause is nonexistent or 10.60/3.80 * unknown.) 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public IllegalArgumentException(Throwable cause) { 10.60/3.80 super(cause); 10.60/3.80 } 10.60/3.80 10.60/3.80 private static final long serialVersionUID = -5365630128856068164L; 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 /* 10.60/3.80 * Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.80 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.80 * 10.60/3.80 * This code is free software; you can redistribute it and/or modify it 10.60/3.80 * under the terms of the GNU General Public License version 2 only, as 10.60/3.80 * published by the Free Software Foundation. Sun designates this 10.60/3.80 * particular file as subject to the "Classpath" exception as provided 10.60/3.80 * by Sun in the LICENSE file that accompanied this code. 10.60/3.80 * 10.60/3.80 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.80 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.80 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.80 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.80 * accompanied this code). 10.60/3.80 * 10.60/3.80 * You should have received a copy of the GNU General Public License version 10.60/3.80 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.80 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.80 * 10.60/3.80 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.80 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.80 * have any questions. 10.60/3.80 */ 10.60/3.80 10.60/3.80 package javaUtilEx; 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Signals that a method has been invoked at an illegal or 10.60/3.80 * inappropriate time. In other words, the Java environment or 10.60/3.80 * Java application is not in an appropriate state for the requested 10.60/3.80 * operation. 10.60/3.80 * 10.60/3.80 * @author Jonni Kanerva 10.60/3.80 * @since JDK1.1 10.60/3.80 */ 10.60/3.80 public 10.60/3.80 class IllegalStateException extends RuntimeException { 10.60/3.80 /** 10.60/3.80 * Constructs an IllegalStateException with no detail message. 10.60/3.80 * A detail message is a String that describes this particular exception. 10.60/3.80 */ 10.60/3.80 public IllegalStateException() { 10.60/3.80 super(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs an IllegalStateException with the specified detail 10.60/3.80 * message. A detail message is a String that describes this particular 10.60/3.80 * exception. 10.60/3.80 * 10.60/3.80 * @param s the String that contains a detailed message 10.60/3.80 */ 10.60/3.80 public IllegalStateException(String s) { 10.60/3.80 super(s); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs a new exception with the specified detail message and 10.60/3.80 * cause. 10.60/3.80 * 10.60/3.80 *

Note that the detail message associated with cause is 10.60/3.80 * not automatically incorporated in this exception's detail 10.60/3.80 * message. 10.60/3.80 * 10.60/3.80 * @param message the detail message (which is saved for later retrieval 10.60/3.80 * by the {@link Throwable#getMessage()} method). 10.60/3.80 * @param cause the cause (which is saved for later retrieval by the 10.60/3.80 * {@link Throwable#getCause()} method). (A null value 10.60/3.80 * is permitted, and indicates that the cause is nonexistent or 10.60/3.80 * unknown.) 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public IllegalStateException(String message, Throwable cause) { 10.60/3.80 super(message, cause); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs a new exception with the specified cause and a detail 10.60/3.80 * message of (cause==null ? null : cause.toString()) (which 10.60/3.80 * typically contains the class and detail message of cause). 10.60/3.80 * This constructor is useful for exceptions that are little more than 10.60/3.80 * wrappers for other throwables (for example, {@link 10.60/3.80 * java.security.PrivilegedActionException}). 10.60/3.80 * 10.60/3.80 * @param cause the cause (which is saved for later retrieval by the 10.60/3.80 * {@link Throwable#getCause()} method). (A null value is 10.60/3.80 * permitted, and indicates that the cause is nonexistent or 10.60/3.80 * unknown.) 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public IllegalStateException(Throwable cause) { 10.60/3.80 super(cause); 10.60/3.80 } 10.60/3.80 10.60/3.80 static final long serialVersionUID = -1848914673093119416L; 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 /* 10.60/3.80 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.80 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.80 * 10.60/3.80 * This code is free software; you can redistribute it and/or modify it 10.60/3.80 * under the terms of the GNU General Public License version 2 only, as 10.60/3.80 * published by the Free Software Foundation. Sun designates this 10.60/3.80 * particular file as subject to the "Classpath" exception as provided 10.60/3.80 * by Sun in the LICENSE file that accompanied this code. 10.60/3.80 * 10.60/3.80 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.80 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.80 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.80 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.80 * accompanied this code). 10.60/3.80 * 10.60/3.80 * You should have received a copy of the GNU General Public License version 10.60/3.80 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.80 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.80 * 10.60/3.80 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.80 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.80 * have any questions. 10.60/3.80 */ 10.60/3.80 10.60/3.80 package javaUtilEx; 10.60/3.80 10.60/3.80 /** 10.60/3.80 * An iterator over a collection. {@code Iterator} takes the place of 10.60/3.80 * {@link Enumeration} in the Java Collections Framework. Iterators 10.60/3.80 * differ from enumerations in two ways: 10.60/3.80 * 10.60/3.80 *

10.60/3.80 * 10.60/3.80 *

This interface is a member of the 10.60/3.80 * 10.60/3.80 * Java Collections Framework. 10.60/3.80 * 10.60/3.80 * @author Josh Bloch 10.60/3.80 * @see Collection 10.60/3.80 * @see ListIterator 10.60/3.80 * @see Iterable 10.60/3.80 * @since 1.2 10.60/3.80 */ 10.60/3.80 public interface Iterator { 10.60/3.80 /** 10.60/3.80 * Returns {@code true} if the iteration has more elements. 10.60/3.80 * (In other words, returns {@code true} if {@link #next} would 10.60/3.80 * return an element rather than throwing an exception.) 10.60/3.80 * 10.60/3.80 * @return {@code true} if the iteration has more elements 10.60/3.80 */ 10.60/3.80 boolean hasNext(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the next element in the iteration. 10.60/3.80 * 10.60/3.80 * @return the next element in the iteration 10.60/3.80 * @throws NoSuchElementException if the iteration has no more elements 10.60/3.80 */ 10.60/3.80 E next(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes from the underlying collection the last element returned 10.60/3.80 * by this iterator (optional operation). This method can be called 10.60/3.80 * only once per call to {@link #next}. The behavior of an iterator 10.60/3.80 * is unspecified if the underlying collection is modified while the 10.60/3.80 * iteration is in progress in any way other than by calling this 10.60/3.80 * method. 10.60/3.80 * 10.60/3.80 * @throws UnsupportedOperationException if the {@code remove} 10.60/3.80 * operation is not supported by this iterator 10.60/3.80 * 10.60/3.80 * @throws IllegalStateException if the {@code next} method has not 10.60/3.80 * yet been called, or the {@code remove} method has already 10.60/3.80 * been called after the last call to the {@code next} 10.60/3.80 * method 10.60/3.80 */ 10.60/3.80 void remove(); 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 package javaUtilEx; 10.60/3.80 10.60/3.80 public class juLinkedListCreate { 10.60/3.80 public static void main(String[] args) { 10.60/3.80 Random.args = args; 10.60/3.80 10.60/3.80 LinkedList l = createList(Random.random()); 10.60/3.80 } 10.60/3.80 10.60/3.80 public static LinkedList createList(int n) { 10.60/3.80 LinkedList l = new LinkedList(); 10.60/3.80 while (n > 0) { 10.60/3.80 l.addFirst(new Content(Random.random())); 10.60/3.80 n--; 10.60/3.80 } 10.60/3.80 return l; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 10.60/3.80 final class Content { 10.60/3.80 int val; 10.60/3.80 10.60/3.80 public Content(int v) { 10.60/3.80 this.val = v; 10.60/3.80 } 10.60/3.80 10.60/3.80 public int hashCode() { 10.60/3.80 return val^31; 10.60/3.80 } 10.60/3.80 10.60/3.80 public boolean equals(Object o) { 10.60/3.80 if (o instanceof Content) { 10.60/3.80 return this.val == ((Content) o).val; 10.60/3.80 } 10.60/3.80 return false; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 /* 10.60/3.80 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.80 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.80 * 10.60/3.80 * This code is free software; you can redistribute it and/or modify it 10.60/3.80 * under the terms of the GNU General Public License version 2 only, as 10.60/3.80 * published by the Free Software Foundation. Sun designates this 10.60/3.80 * particular file as subject to the "Classpath" exception as provided 10.60/3.80 * by Sun in the LICENSE file that accompanied this code. 10.60/3.80 * 10.60/3.80 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.80 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.80 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.80 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.80 * accompanied this code). 10.60/3.80 * 10.60/3.80 * You should have received a copy of the GNU General Public License version 10.60/3.80 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.80 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.80 * 10.60/3.80 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.80 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.80 * have any questions. 10.60/3.80 */ 10.60/3.80 10.60/3.80 package javaUtilEx; 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Linked list implementation of the List interface. Implements all 10.60/3.80 * optional list operations, and permits all elements (including 10.60/3.80 * null). In addition to implementing the List interface, 10.60/3.80 * the LinkedList class provides uniformly named methods to 10.60/3.80 * get, remove and insert an element at the 10.60/3.80 * beginning and end of the list. These operations allow linked lists to be 10.60/3.80 * used as a stack, {@linkplain Queue queue}, or {@linkplain Deque 10.60/3.80 * double-ended queue}.

10.60/3.80 * 10.60/3.80 * The class implements the Deque interface, providing 10.60/3.80 * first-in-first-out queue operations for add, 10.60/3.80 * poll, along with other stack and deque operations.

10.60/3.80 * 10.60/3.80 * All of the operations perform as could be expected for a doubly-linked 10.60/3.80 * list. Operations that index into the list will traverse the list from 10.60/3.80 * the beginning or the end, whichever is closer to the specified index.

10.60/3.80 * 10.60/3.80 *

Note that this implementation is not synchronized. 10.60/3.80 * If multiple threads access a linked list concurrently, and at least 10.60/3.80 * one of the threads modifies the list structurally, it must be 10.60/3.80 * synchronized externally. (A structural modification is any operation 10.60/3.80 * that adds or deletes one or more elements; merely setting the value of 10.60/3.80 * an element is not a structural modification.) This is typically 10.60/3.80 * accomplished by synchronizing on some object that naturally 10.60/3.80 * encapsulates the list. 10.60/3.80 * 10.60/3.80 * If no such object exists, the list should be "wrapped" using the 10.60/3.80 * {@link Collections#synchronizedList Collections.synchronizedList} 10.60/3.80 * method. This is best done at creation time, to prevent accidental 10.60/3.80 * unsynchronized access to the list:

10.60/3.80	 *   List list = Collections.synchronizedList(new LinkedList(...));
10.60/3.80 * 10.60/3.80 *

The iterators returned by this class's iterator and 10.60/3.80 * listIterator methods are fail-fast: if the list is 10.60/3.80 * structurally modified at any time after the iterator is created, in 10.60/3.80 * any way except through the Iterator's own remove or 10.60/3.80 * add methods, the iterator will throw a {@link 10.60/3.80 * ConcurrentModificationException}. Thus, in the face of concurrent 10.60/3.80 * modification, the iterator fails quickly and cleanly, rather than 10.60/3.80 * risking arbitrary, non-deterministic behavior at an undetermined 10.60/3.80 * time in the future. 10.60/3.80 * 10.60/3.80 *

Note that the fail-fast behavior of an iterator cannot be guaranteed 10.60/3.80 * as it is, generally speaking, impossible to make any hard guarantees in the 10.60/3.80 * presence of unsynchronized concurrent modification. Fail-fast iterators 10.60/3.80 * throw ConcurrentModificationException on a best-effort basis. 10.60/3.80 * Therefore, it would be wrong to write a program that depended on this 10.60/3.80 * exception for its correctness: the fail-fast behavior of iterators 10.60/3.80 * should be used only to detect bugs. 10.60/3.80 * 10.60/3.80 *

This class is a member of the 10.60/3.80 * 10.60/3.80 * Java Collections Framework. 10.60/3.80 * 10.60/3.80 * @author Josh Bloch 10.60/3.80 * @see List 10.60/3.80 * @see ArrayList 10.60/3.80 * @see Vector 10.60/3.80 * @since 1.2 10.60/3.80 * @param the type of elements held in this collection 10.60/3.80 */ 10.60/3.80 10.60/3.80 public class LinkedList 10.60/3.80 extends AbstractSequentialList 10.60/3.80 implements List, Deque 10.60/3.80 { 10.60/3.80 private transient Entry header = new Entry(null, null, null); 10.60/3.80 private transient int size = 0; 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs an empty list. 10.60/3.80 */ 10.60/3.80 public LinkedList() { 10.60/3.80 header.next = header.previous = header; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Constructs a list containing the elements of the specified 10.60/3.80 * collection, in the order they are returned by the collection's 10.60/3.80 * iterator. 10.60/3.80 * 10.60/3.80 * @param c the collection whose elements are to be placed into this list 10.60/3.80 * @throws NullPointerException if the specified collection is null 10.60/3.80 */ 10.60/3.80 public LinkedList(Collection c) { 10.60/3.80 this(); 10.60/3.80 addAll(c); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the first element in this list. 10.60/3.80 * 10.60/3.80 * @return the first element in this list 10.60/3.80 * @throws NoSuchElementException if this list is empty 10.60/3.80 */ 10.60/3.80 public E getFirst() { 10.60/3.80 if (size==0) 10.60/3.80 throw new NoSuchElementException(); 10.60/3.80 10.60/3.80 return header.next.element; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the last element in this list. 10.60/3.80 * 10.60/3.80 * @return the last element in this list 10.60/3.80 * @throws NoSuchElementException if this list is empty 10.60/3.80 */ 10.60/3.80 public E getLast() { 10.60/3.80 if (size==0) 10.60/3.80 throw new NoSuchElementException(); 10.60/3.80 10.60/3.80 return header.previous.element; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes and returns the first element from this list. 10.60/3.80 * 10.60/3.80 * @return the first element from this list 10.60/3.80 * @throws NoSuchElementException if this list is empty 10.60/3.80 */ 10.60/3.80 public E removeFirst() { 10.60/3.80 return remove(header.next); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes and returns the last element from this list. 10.60/3.80 * 10.60/3.80 * @return the last element from this list 10.60/3.80 * @throws NoSuchElementException if this list is empty 10.60/3.80 */ 10.60/3.80 public E removeLast() { 10.60/3.80 return remove(header.previous); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the beginning of this list. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 */ 10.60/3.80 public void addFirst(E e) { 10.60/3.80 addBefore(e, header.next); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Appends the specified element to the end of this list. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #add}. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 */ 10.60/3.80 public void addLast(E e) { 10.60/3.80 addBefore(e, header); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns true if this list contains the specified element. 10.60/3.80 * More formally, returns true if and only if this list contains 10.60/3.80 * at least one element e such that 10.60/3.80 * (o==null ? e==null : o.equals(e)). 10.60/3.80 * 10.60/3.80 * @param o element whose presence in this list is to be tested 10.60/3.80 * @return true if this list contains the specified element 10.60/3.80 */ 10.60/3.80 public boolean contains(Object o) { 10.60/3.80 return indexOf(o) != -1; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the number of elements in this list. 10.60/3.80 * 10.60/3.80 * @return the number of elements in this list 10.60/3.80 */ 10.60/3.80 public int size() { 10.60/3.80 return size; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Appends the specified element to the end of this list. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #addLast}. 10.60/3.80 * 10.60/3.80 * @param e element to be appended to this list 10.60/3.80 * @return true (as specified by {@link Collection#add}) 10.60/3.80 */ 10.60/3.80 public boolean add(E e) { 10.60/3.80 addBefore(e, header); 10.60/3.80 return true; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the first occurrence of the specified element from this list, 10.60/3.80 * if it is present. If this list does not contain the element, it is 10.60/3.80 * unchanged. More formally, removes the element with the lowest index 10.60/3.80 * i such that 10.60/3.80 * (o==null ? get(i)==null : o.equals(get(i))) 10.60/3.80 * (if such an element exists). Returns true if this list 10.60/3.80 * contained the specified element (or equivalently, if this list 10.60/3.80 * changed as a result of the call). 10.60/3.80 * 10.60/3.80 * @param o element to be removed from this list, if present 10.60/3.80 * @return true if this list contained the specified element 10.60/3.80 */ 10.60/3.80 public boolean remove(Object o) { 10.60/3.80 if (o==null) { 10.60/3.80 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.80 if (e.element==null) { 10.60/3.80 remove(e); 10.60/3.80 return true; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 } else { 10.60/3.80 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.80 if (o.equals(e.element)) { 10.60/3.80 remove(e); 10.60/3.80 return true; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 } 10.60/3.80 return false; 10.60/3.80 } 10.60/3.80 /** 10.60/3.80 * Removes all of the elements from this list. 10.60/3.80 */ 10.60/3.80 public void clear() { 10.60/3.80 Entry e = header.next; 10.60/3.80 while (e != header) { 10.60/3.80 Entry next = e.next; 10.60/3.80 e.next = e.previous = null; 10.60/3.80 e.element = null; 10.60/3.80 e = next; 10.60/3.80 } 10.60/3.80 header.next = header.previous = header; 10.60/3.80 size = 0; 10.60/3.80 modCount++; 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 // Positional Access Operations 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the element at the specified position in this list. 10.60/3.80 * 10.60/3.80 * @param index index of the element to return 10.60/3.80 * @return the element at the specified position in this list 10.60/3.80 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.80 */ 10.60/3.80 public E get(int index) { 10.60/3.80 return entry(index).element; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Replaces the element at the specified position in this list with the 10.60/3.80 * specified element. 10.60/3.80 * 10.60/3.80 * @param index index of the element to replace 10.60/3.80 * @param element element to be stored at the specified position 10.60/3.80 * @return the element previously at the specified position 10.60/3.80 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.80 */ 10.60/3.80 public E set(int index, E element) { 10.60/3.80 Entry e = entry(index); 10.60/3.80 E oldVal = e.element; 10.60/3.80 e.element = element; 10.60/3.80 return oldVal; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the specified position in this list. 10.60/3.80 * Shifts the element currently at that position (if any) and any 10.60/3.80 * subsequent elements to the right (adds one to their indices). 10.60/3.80 * 10.60/3.80 * @param index index at which the specified element is to be inserted 10.60/3.80 * @param element element to be inserted 10.60/3.80 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.80 */ 10.60/3.80 public void add(int index, E element) { 10.60/3.80 addBefore(element, (index==size ? header : entry(index))); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the element at the specified position in this list. Shifts any 10.60/3.80 * subsequent elements to the left (subtracts one from their indices). 10.60/3.80 * Returns the element that was removed from the list. 10.60/3.80 * 10.60/3.80 * @param index the index of the element to be removed 10.60/3.80 * @return the element previously at the specified position 10.60/3.80 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.80 */ 10.60/3.80 public E remove(int index) { 10.60/3.80 return remove(entry(index)); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the indexed entry. 10.60/3.80 */ 10.60/3.80 private Entry entry(int index) { 10.60/3.80 if (index < 0 || index >= size) 10.60/3.80 throw new IndexOutOfBoundsException(); 10.60/3.80 Entry e = header; 10.60/3.80 if (index < (size >> 1)) { 10.60/3.80 for (int i = 0; i <= index; i++) 10.60/3.80 e = e.next; 10.60/3.80 } else { 10.60/3.80 for (int i = size; i > index; i--) 10.60/3.80 e = e.previous; 10.60/3.80 } 10.60/3.80 return e; 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 // Search Operations 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the index of the first occurrence of the specified element 10.60/3.80 * in this list, or -1 if this list does not contain the element. 10.60/3.80 * More formally, returns the lowest index i such that 10.60/3.80 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.80 * or -1 if there is no such index. 10.60/3.80 * 10.60/3.80 * @param o element to search for 10.60/3.80 * @return the index of the first occurrence of the specified element in 10.60/3.80 * this list, or -1 if this list does not contain the element 10.60/3.80 */ 10.60/3.80 public int indexOf(Object o) { 10.60/3.80 int index = 0; 10.60/3.80 if (o==null) { 10.60/3.80 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.80 if (e.element==null) 10.60/3.80 return index; 10.60/3.80 index++; 10.60/3.80 } 10.60/3.80 } else { 10.60/3.80 for (Entry e = header.next; e != header; e = e.next) { 10.60/3.80 if (o.equals(e.element)) 10.60/3.80 return index; 10.60/3.80 index++; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 return -1; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the index of the last occurrence of the specified element 10.60/3.80 * in this list, or -1 if this list does not contain the element. 10.60/3.80 * More formally, returns the highest index i such that 10.60/3.80 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.80 * or -1 if there is no such index. 10.60/3.80 * 10.60/3.80 * @param o element to search for 10.60/3.80 * @return the index of the last occurrence of the specified element in 10.60/3.80 * this list, or -1 if this list does not contain the element 10.60/3.80 */ 10.60/3.80 public int lastIndexOf(Object o) { 10.60/3.80 int index = size; 10.60/3.80 if (o==null) { 10.60/3.80 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.80 index--; 10.60/3.80 if (e.element==null) 10.60/3.80 return index; 10.60/3.80 } 10.60/3.80 } else { 10.60/3.80 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.80 index--; 10.60/3.80 if (o.equals(e.element)) 10.60/3.80 return index; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 return -1; 10.60/3.80 } 10.60/3.80 10.60/3.80 // Queue operations. 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the head (first element) of this list. 10.60/3.80 * @return the head of this list, or null if this list is empty 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public E peek() { 10.60/3.80 if (size==0) 10.60/3.80 return null; 10.60/3.80 return getFirst(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the head (first element) of this list. 10.60/3.80 * @return the head of this list 10.60/3.80 * @throws NoSuchElementException if this list is empty 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public E element() { 10.60/3.80 return getFirst(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the head (first element) of this list 10.60/3.80 * @return the head of this list, or null if this list is empty 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public E poll() { 10.60/3.80 if (size==0) 10.60/3.80 return null; 10.60/3.80 return removeFirst(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the head (first element) of this list. 10.60/3.80 * 10.60/3.80 * @return the head of this list 10.60/3.80 * @throws NoSuchElementException if this list is empty 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public E remove() { 10.60/3.80 return removeFirst(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Adds the specified element as the tail (last element) of this list. 10.60/3.80 * 10.60/3.80 * @param e the element to add 10.60/3.80 * @return true (as specified by {@link Queue#offer}) 10.60/3.80 * @since 1.5 10.60/3.80 */ 10.60/3.80 public boolean offer(E e) { 10.60/3.80 return add(e); 10.60/3.80 } 10.60/3.80 10.60/3.80 // Deque operations 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the front of this list. 10.60/3.80 * 10.60/3.80 * @param e the element to insert 10.60/3.80 * @return true (as specified by {@link Deque#offerFirst}) 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public boolean offerFirst(E e) { 10.60/3.80 addFirst(e); 10.60/3.80 return true; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element at the end of this list. 10.60/3.80 * 10.60/3.80 * @param e the element to insert 10.60/3.80 * @return true (as specified by {@link Deque#offerLast}) 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public boolean offerLast(E e) { 10.60/3.80 addLast(e); 10.60/3.80 return true; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the first element of this list, 10.60/3.80 * or returns null if this list is empty. 10.60/3.80 * 10.60/3.80 * @return the first element of this list, or null 10.60/3.80 * if this list is empty 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public E peekFirst() { 10.60/3.80 if (size==0) 10.60/3.80 return null; 10.60/3.80 return getFirst(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves, but does not remove, the last element of this list, 10.60/3.80 * or returns null if this list is empty. 10.60/3.80 * 10.60/3.80 * @return the last element of this list, or null 10.60/3.80 * if this list is empty 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public E peekLast() { 10.60/3.80 if (size==0) 10.60/3.80 return null; 10.60/3.80 return getLast(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the first element of this list, 10.60/3.80 * or returns null if this list is empty. 10.60/3.80 * 10.60/3.80 * @return the first element of this list, or null if 10.60/3.80 * this list is empty 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public E pollFirst() { 10.60/3.80 if (size==0) 10.60/3.80 return null; 10.60/3.80 return removeFirst(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Retrieves and removes the last element of this list, 10.60/3.80 * or returns null if this list is empty. 10.60/3.80 * 10.60/3.80 * @return the last element of this list, or null if 10.60/3.80 * this list is empty 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public E pollLast() { 10.60/3.80 if (size==0) 10.60/3.80 return null; 10.60/3.80 return removeLast(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Pushes an element onto the stack represented by this list. In other 10.60/3.80 * words, inserts the element at the front of this list. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #addFirst}. 10.60/3.80 * 10.60/3.80 * @param e the element to push 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public void push(E e) { 10.60/3.80 addFirst(e); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Pops an element from the stack represented by this list. In other 10.60/3.80 * words, removes and returns the first element of this list. 10.60/3.80 * 10.60/3.80 *

This method is equivalent to {@link #removeFirst()}. 10.60/3.80 * 10.60/3.80 * @return the element at the front of this list (which is the top 10.60/3.80 * of the stack represented by this list) 10.60/3.80 * @throws NoSuchElementException if this list is empty 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public E pop() { 10.60/3.80 return removeFirst(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the first occurrence of the specified element in this 10.60/3.80 * list (when traversing the list from head to tail). If the list 10.60/3.80 * does not contain the element, it is unchanged. 10.60/3.80 * 10.60/3.80 * @param o element to be removed from this list, if present 10.60/3.80 * @return true if the list contained the specified element 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public boolean removeFirstOccurrence(Object o) { 10.60/3.80 return remove(o); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the last occurrence of the specified element in this 10.60/3.80 * list (when traversing the list from head to tail). If the list 10.60/3.80 * does not contain the element, it is unchanged. 10.60/3.80 * 10.60/3.80 * @param o element to be removed from this list, if present 10.60/3.80 * @return true if the list contained the specified element 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public boolean removeLastOccurrence(Object o) { 10.60/3.80 if (o==null) { 10.60/3.80 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.80 if (e.element==null) { 10.60/3.80 remove(e); 10.60/3.80 return true; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 } else { 10.60/3.80 for (Entry e = header.previous; e != header; e = e.previous) { 10.60/3.80 if (o.equals(e.element)) { 10.60/3.80 remove(e); 10.60/3.80 return true; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 } 10.60/3.80 return false; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns a list-iterator of the elements in this list (in proper 10.60/3.80 * sequence), starting at the specified position in the list. 10.60/3.80 * Obeys the general contract of List.listIterator(int).

10.60/3.80 * 10.60/3.80 * The list-iterator is fail-fast: if the list is structurally 10.60/3.80 * modified at any time after the Iterator is created, in any way except 10.60/3.80 * through the list-iterator's own remove or add 10.60/3.80 * methods, the list-iterator will throw a 10.60/3.80 * ConcurrentModificationException. Thus, in the face of 10.60/3.80 * concurrent modification, the iterator fails quickly and cleanly, rather 10.60/3.80 * than risking arbitrary, non-deterministic behavior at an undetermined 10.60/3.80 * time in the future. 10.60/3.80 * 10.60/3.80 * @param index index of the first element to be returned from the 10.60/3.80 * list-iterator (by a call to next) 10.60/3.80 * @return a ListIterator of the elements in this list (in proper 10.60/3.80 * sequence), starting at the specified position in the list 10.60/3.80 * @throws IndexOutOfBoundsException {@inheritDoc} 10.60/3.80 * @see List#listIterator(int) 10.60/3.80 */ 10.60/3.80 public ListIterator listIterator(int index) { 10.60/3.80 return new ListItr(index); 10.60/3.80 } 10.60/3.80 10.60/3.80 private class ListItr implements ListIterator { 10.60/3.80 private Entry lastReturned = header; 10.60/3.80 private Entry next; 10.60/3.80 private int nextIndex; 10.60/3.80 private int expectedModCount = modCount; 10.60/3.80 10.60/3.80 ListItr(int index) { 10.60/3.80 if (index < 0 || index > size) 10.60/3.80 throw new IndexOutOfBoundsException(); 10.60/3.80 if (index < (size >> 1)) { 10.60/3.80 next = header.next; 10.60/3.80 for (nextIndex=0; nextIndexindex; nextIndex--) 10.60/3.80 next = next.previous; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 10.60/3.80 public boolean hasNext() { 10.60/3.80 return nextIndex != size; 10.60/3.80 } 10.60/3.80 10.60/3.80 public E next() { 10.60/3.80 checkForComodification(); 10.60/3.80 if (nextIndex == size) 10.60/3.80 throw new NoSuchElementException(); 10.60/3.80 10.60/3.80 lastReturned = next; 10.60/3.80 next = next.next; 10.60/3.80 nextIndex++; 10.60/3.80 return lastReturned.element; 10.60/3.80 } 10.60/3.80 10.60/3.80 public boolean hasPrevious() { 10.60/3.80 return nextIndex != 0; 10.60/3.80 } 10.60/3.80 10.60/3.80 public E previous() { 10.60/3.80 if (nextIndex == 0) 10.60/3.80 throw new NoSuchElementException(); 10.60/3.80 10.60/3.80 lastReturned = next = next.previous; 10.60/3.80 nextIndex--; 10.60/3.80 checkForComodification(); 10.60/3.80 return lastReturned.element; 10.60/3.80 } 10.60/3.80 10.60/3.80 public int nextIndex() { 10.60/3.80 return nextIndex; 10.60/3.80 } 10.60/3.80 10.60/3.80 public int previousIndex() { 10.60/3.80 return nextIndex-1; 10.60/3.80 } 10.60/3.80 10.60/3.80 public void remove() { 10.60/3.80 checkForComodification(); 10.60/3.80 Entry lastNext = lastReturned.next; 10.60/3.80 try { 10.60/3.80 LinkedList.this.remove(lastReturned); 10.60/3.80 } catch (NoSuchElementException e) { 10.60/3.80 throw new IllegalStateException(); 10.60/3.80 } 10.60/3.80 if (next==lastReturned) 10.60/3.80 next = lastNext; 10.60/3.80 else 10.60/3.80 nextIndex--; 10.60/3.80 lastReturned = header; 10.60/3.80 expectedModCount++; 10.60/3.80 } 10.60/3.80 10.60/3.80 public void set(E e) { 10.60/3.80 if (lastReturned == header) 10.60/3.80 throw new IllegalStateException(); 10.60/3.80 checkForComodification(); 10.60/3.80 lastReturned.element = e; 10.60/3.80 } 10.60/3.80 10.60/3.80 public void add(E e) { 10.60/3.80 checkForComodification(); 10.60/3.80 lastReturned = header; 10.60/3.80 addBefore(e, next); 10.60/3.80 nextIndex++; 10.60/3.80 expectedModCount++; 10.60/3.80 } 10.60/3.80 10.60/3.80 final void checkForComodification() { 10.60/3.80 if (modCount != expectedModCount) 10.60/3.80 throw new ConcurrentModificationException(); 10.60/3.80 } 10.60/3.80 } 10.60/3.80 10.60/3.80 private static class Entry { 10.60/3.80 E element; 10.60/3.80 Entry next; 10.60/3.80 Entry previous; 10.60/3.80 10.60/3.80 Entry(E element, Entry next, Entry previous) { 10.60/3.80 this.element = element; 10.60/3.80 this.next = next; 10.60/3.80 this.previous = previous; 10.60/3.80 } 10.60/3.80 } 10.60/3.80 10.60/3.80 private Entry addBefore(E e, Entry entry) { 10.60/3.80 Entry newEntry = new Entry(e, entry, entry.previous); 10.60/3.80 newEntry.previous.next = newEntry; 10.60/3.80 newEntry.next.previous = newEntry; 10.60/3.80 size++; 10.60/3.80 modCount++; 10.60/3.80 return newEntry; 10.60/3.80 } 10.60/3.80 10.60/3.80 private E remove(Entry e) { 10.60/3.80 if (e == header) 10.60/3.80 throw new NoSuchElementException(); 10.60/3.80 10.60/3.80 E result = e.element; 10.60/3.80 e.previous.next = e.next; 10.60/3.80 e.next.previous = e.previous; 10.60/3.80 e.next = e.previous = null; 10.60/3.80 e.element = null; 10.60/3.80 size--; 10.60/3.80 modCount++; 10.60/3.80 return result; 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * @since 1.6 10.60/3.80 */ 10.60/3.80 public Iterator descendingIterator() { 10.60/3.80 return new DescendingIterator(); 10.60/3.80 } 10.60/3.80 10.60/3.80 /** Adapter to provide descending iterators via ListItr.previous */ 10.60/3.80 private class DescendingIterator implements Iterator { 10.60/3.80 final ListItr itr = new ListItr(size()); 10.60/3.80 public boolean hasNext() { 10.60/3.80 return itr.hasPrevious(); 10.60/3.80 } 10.60/3.80 public E next() { 10.60/3.80 return itr.previous(); 10.60/3.80 } 10.60/3.80 public void remove() { 10.60/3.80 itr.remove(); 10.60/3.80 } 10.60/3.80 } 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns an array containing all of the elements in this list 10.60/3.80 * in proper sequence (from first to last element). 10.60/3.80 * 10.60/3.80 *

The returned array will be "safe" in that no references to it are 10.60/3.80 * maintained by this list. (In other words, this method must allocate 10.60/3.80 * a new array). The caller is thus free to modify the returned array. 10.60/3.80 * 10.60/3.80 *

This method acts as bridge between array-based and collection-based 10.60/3.80 * APIs. 10.60/3.80 * 10.60/3.80 * @return an array containing all of the elements in this list 10.60/3.80 * in proper sequence 10.60/3.80 */ 10.60/3.80 public Object[] toArray() { 10.60/3.80 Object[] result = new Object[size]; 10.60/3.80 int i = 0; 10.60/3.80 for (Entry e = header.next; e != header; e = e.next) 10.60/3.80 result[i++] = e.element; 10.60/3.80 return result; 10.60/3.80 } 10.60/3.80 10.60/3.80 private static final long serialVersionUID = 876323262645176354L; 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 /* 10.60/3.80 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.80 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.80 * 10.60/3.80 * This code is free software; you can redistribute it and/or modify it 10.60/3.80 * under the terms of the GNU General Public License version 2 only, as 10.60/3.80 * published by the Free Software Foundation. Sun designates this 10.60/3.80 * particular file as subject to the "Classpath" exception as provided 10.60/3.80 * by Sun in the LICENSE file that accompanied this code. 10.60/3.80 * 10.60/3.80 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.80 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.80 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.80 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.80 * accompanied this code). 10.60/3.80 * 10.60/3.80 * You should have received a copy of the GNU General Public License version 10.60/3.80 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.80 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.80 * 10.60/3.80 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.80 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.80 * have any questions. 10.60/3.80 */ 10.60/3.80 10.60/3.80 package javaUtilEx; 10.60/3.80 10.60/3.80 /** 10.60/3.80 * An iterator for lists that allows the programmer 10.60/3.80 * to traverse the list in either direction, modify 10.60/3.80 * the list during iteration, and obtain the iterator's 10.60/3.80 * current position in the list. A {@code ListIterator} 10.60/3.80 * has no current element; its cursor position always 10.60/3.80 * lies between the element that would be returned by a call 10.60/3.80 * to {@code previous()} and the element that would be 10.60/3.80 * returned by a call to {@code next()}. 10.60/3.80 * An iterator for a list of length {@code n} has {@code n+1} possible 10.60/3.80 * cursor positions, as illustrated by the carets ({@code ^}) below: 10.60/3.80 *

10.60/3.80	 *                      Element(0)   Element(1)   Element(2)   ... Element(n-1)
10.60/3.80	 * cursor positions:  ^            ^            ^            ^                  ^
10.60/3.80	 * 
10.60/3.80 * Note that the {@link #remove} and {@link #set(Object)} methods are 10.60/3.80 * not defined in terms of the cursor position; they are defined to 10.60/3.80 * operate on the last element returned by a call to {@link #next} or 10.60/3.80 * {@link #previous()}. 10.60/3.80 * 10.60/3.80 *

This interface is a member of the 10.60/3.80 * 10.60/3.80 * Java Collections Framework. 10.60/3.80 * 10.60/3.80 * @author Josh Bloch 10.60/3.80 * @see Collection 10.60/3.80 * @see List 10.60/3.80 * @see Iterator 10.60/3.80 * @see Enumeration 10.60/3.80 * @see List#listIterator() 10.60/3.80 * @since 1.2 10.60/3.80 */ 10.60/3.80 public interface ListIterator extends Iterator { 10.60/3.80 // Query Operations 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns {@code true} if this list iterator has more elements when 10.60/3.80 * traversing the list in the forward direction. (In other words, 10.60/3.80 * returns {@code true} if {@link #next} would return an element rather 10.60/3.80 * than throwing an exception.) 10.60/3.80 * 10.60/3.80 * @return {@code true} if the list iterator has more elements when 10.60/3.80 * traversing the list in the forward direction 10.60/3.80 */ 10.60/3.80 boolean hasNext(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the next element in the list and advances the cursor position. 10.60/3.80 * This method may be called repeatedly to iterate through the list, 10.60/3.80 * or intermixed with calls to {@link #previous} to go back and forth. 10.60/3.80 * (Note that alternating calls to {@code next} and {@code previous} 10.60/3.80 * will return the same element repeatedly.) 10.60/3.80 * 10.60/3.80 * @return the next element in the list 10.60/3.80 * @throws NoSuchElementException if the iteration has no next element 10.60/3.80 */ 10.60/3.80 E next(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns {@code true} if this list iterator has more elements when 10.60/3.80 * traversing the list in the reverse direction. (In other words, 10.60/3.80 * returns {@code true} if {@link #previous} would return an element 10.60/3.80 * rather than throwing an exception.) 10.60/3.80 * 10.60/3.80 * @return {@code true} if the list iterator has more elements when 10.60/3.80 * traversing the list in the reverse direction 10.60/3.80 */ 10.60/3.80 boolean hasPrevious(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the previous element in the list and moves the cursor 10.60/3.80 * position backwards. This method may be called repeatedly to 10.60/3.80 * iterate through the list backwards, or intermixed with calls to 10.60/3.80 * {@link #next} to go back and forth. (Note that alternating calls 10.60/3.80 * to {@code next} and {@code previous} will return the same 10.60/3.80 * element repeatedly.) 10.60/3.80 * 10.60/3.80 * @return the previous element in the list 10.60/3.80 * @throws NoSuchElementException if the iteration has no previous 10.60/3.80 * element 10.60/3.80 */ 10.60/3.80 E previous(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the index of the element that would be returned by a 10.60/3.80 * subsequent call to {@link #next}. (Returns list size if the list 10.60/3.80 * iterator is at the end of the list.) 10.60/3.80 * 10.60/3.80 * @return the index of the element that would be returned by a 10.60/3.80 * subsequent call to {@code next}, or list size if the list 10.60/3.80 * iterator is at the end of the list 10.60/3.80 */ 10.60/3.80 int nextIndex(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the index of the element that would be returned by a 10.60/3.80 * subsequent call to {@link #previous}. (Returns -1 if the list 10.60/3.80 * iterator is at the beginning of the list.) 10.60/3.80 * 10.60/3.80 * @return the index of the element that would be returned by a 10.60/3.80 * subsequent call to {@code previous}, or -1 if the list 10.60/3.80 * iterator is at the beginning of the list 10.60/3.80 */ 10.60/3.80 int previousIndex(); 10.60/3.80 10.60/3.80 10.60/3.80 // Modification Operations 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes from the list the last element that was returned by {@link 10.60/3.80 * #next} or {@link #previous} (optional operation). This call can 10.60/3.80 * only be made once per call to {@code next} or {@code previous}. 10.60/3.80 * It can be made only if {@link #add} has not been 10.60/3.80 * called after the last call to {@code next} or {@code previous}. 10.60/3.80 * 10.60/3.80 * @throws UnsupportedOperationException if the {@code remove} 10.60/3.80 * operation is not supported by this list iterator 10.60/3.80 * @throws IllegalStateException if neither {@code next} nor 10.60/3.80 * {@code previous} have been called, or {@code remove} or 10.60/3.80 * {@code add} have been called after the last call to 10.60/3.80 * {@code next} or {@code previous} 10.60/3.80 */ 10.60/3.80 void remove(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Replaces the last element returned by {@link #next} or 10.60/3.80 * {@link #previous} with the specified element (optional operation). 10.60/3.80 * This call can be made only if neither {@link #remove} nor {@link 10.60/3.80 * #add} have been called after the last call to {@code next} or 10.60/3.80 * {@code previous}. 10.60/3.80 * 10.60/3.80 * @param e the element with which to replace the last element returned by 10.60/3.80 * {@code next} or {@code previous} 10.60/3.80 * @throws UnsupportedOperationException if the {@code set} operation 10.60/3.80 * is not supported by this list iterator 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this list 10.60/3.80 * @throws IllegalArgumentException if some aspect of the specified 10.60/3.80 * element prevents it from being added to this list 10.60/3.80 * @throws IllegalStateException if neither {@code next} nor 10.60/3.80 * {@code previous} have been called, or {@code remove} or 10.60/3.80 * {@code add} have been called after the last call to 10.60/3.80 * {@code next} or {@code previous} 10.60/3.80 */ 10.60/3.80 void set(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts the specified element into the list (optional operation). 10.60/3.80 * The element is inserted immediately before the next element that 10.60/3.80 * would be returned by {@link #next}, if any, and after the next 10.60/3.80 * element that would be returned by {@link #previous}, if any. (If the 10.60/3.80 * list contains no elements, the new element becomes the sole element 10.60/3.80 * on the list.) The new element is inserted before the implicit 10.60/3.80 * cursor: a subsequent call to {@code next} would be unaffected, and a 10.60/3.80 * subsequent call to {@code previous} would return the new element. 10.60/3.80 * (This call increases by one the value that would be returned by a 10.60/3.80 * call to {@code nextIndex} or {@code previousIndex}.) 10.60/3.80 * 10.60/3.80 * @param e the element to insert 10.60/3.80 * @throws UnsupportedOperationException if the {@code add} method is 10.60/3.80 * not supported by this list iterator 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this list 10.60/3.80 * @throws IllegalArgumentException if some aspect of this element 10.60/3.80 * prevents it from being added to this list 10.60/3.80 */ 10.60/3.80 void add(E e); 10.60/3.80 } 10.60/3.80 10.60/3.80 10.60/3.80 /* 10.60/3.80 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.80 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.80 * 10.60/3.80 * This code is free software; you can redistribute it and/or modify it 10.60/3.80 * under the terms of the GNU General Public License version 2 only, as 10.60/3.80 * published by the Free Software Foundation. Sun designates this 10.60/3.80 * particular file as subject to the "Classpath" exception as provided 10.60/3.80 * by Sun in the LICENSE file that accompanied this code. 10.60/3.80 * 10.60/3.80 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.80 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.80 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.80 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.80 * accompanied this code). 10.60/3.80 * 10.60/3.80 * You should have received a copy of the GNU General Public License version 10.60/3.80 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.80 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.80 * 10.60/3.80 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.80 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.80 * have any questions. 10.60/3.80 */ 10.60/3.80 10.60/3.80 package javaUtilEx; 10.60/3.80 10.60/3.80 /** 10.60/3.80 * An ordered collection (also known as a sequence). The user of this 10.60/3.80 * interface has precise control over where in the list each element is 10.60/3.80 * inserted. The user can access elements by their integer index (position in 10.60/3.80 * the list), and search for elements in the list.

10.60/3.80 * 10.60/3.80 * Unlike sets, lists typically allow duplicate elements. More formally, 10.60/3.80 * lists typically allow pairs of elements e1 and e2 10.60/3.80 * such that e1.equals(e2), and they typically allow multiple 10.60/3.80 * null elements if they allow null elements at all. It is not inconceivable 10.60/3.80 * that someone might wish to implement a list that prohibits duplicates, by 10.60/3.80 * throwing runtime exceptions when the user attempts to insert them, but we 10.60/3.80 * expect this usage to be rare.

10.60/3.80 * 10.60/3.80 * The List interface places additional stipulations, beyond those 10.60/3.80 * specified in the Collection interface, on the contracts of the 10.60/3.80 * iterator, add, remove, equals, and 10.60/3.80 * hashCode methods. Declarations for other inherited methods are 10.60/3.80 * also included here for convenience.

10.60/3.80 * 10.60/3.80 * The List interface provides four methods for positional (indexed) 10.60/3.80 * access to list elements. Lists (like Java arrays) are zero based. Note 10.60/3.80 * that these operations may execute in time proportional to the index value 10.60/3.80 * for some implementations (the LinkedList class, for 10.60/3.80 * example). Thus, iterating over the elements in a list is typically 10.60/3.80 * preferable to indexing through it if the caller does not know the 10.60/3.80 * implementation.

10.60/3.80 * 10.60/3.80 * The List interface provides a special iterator, called a 10.60/3.80 * ListIterator, that allows element insertion and replacement, and 10.60/3.80 * bidirectional access in addition to the normal operations that the 10.60/3.80 * Iterator interface provides. A method is provided to obtain a 10.60/3.80 * list iterator that starts at a specified position in the list.

10.60/3.80 * 10.60/3.80 * The List interface provides two methods to search for a specified 10.60/3.80 * object. From a performance standpoint, these methods should be used with 10.60/3.80 * caution. In many implementations they will perform costly linear 10.60/3.80 * searches.

10.60/3.80 * 10.60/3.80 * The List interface provides two methods to efficiently insert and 10.60/3.80 * remove multiple elements at an arbitrary point in the list.

10.60/3.80 * 10.60/3.80 * Note: While it is permissible for lists to contain themselves as elements, 10.60/3.80 * extreme caution is advised: the equals and hashCode 10.60/3.80 * methods are no longer well defined on such a list. 10.60/3.80 * 10.60/3.80 *

Some list implementations have restrictions on the elements that 10.60/3.80 * they may contain. For example, some implementations prohibit null elements, 10.60/3.80 * and some have restrictions on the types of their elements. Attempting to 10.60/3.80 * add an ineligible element throws an unchecked exception, typically 10.60/3.80 * NullPointerException or ClassCastException. Attempting 10.60/3.80 * to query the presence of an ineligible element may throw an exception, 10.60/3.80 * or it may simply return false; some implementations will exhibit the former 10.60/3.80 * behavior and some will exhibit the latter. More generally, attempting an 10.60/3.80 * operation on an ineligible element whose completion would not result in 10.60/3.80 * the insertion of an ineligible element into the list may throw an 10.60/3.80 * exception or it may succeed, at the option of the implementation. 10.60/3.80 * Such exceptions are marked as "optional" in the specification for this 10.60/3.80 * interface. 10.60/3.80 * 10.60/3.80 *

This interface is a member of the 10.60/3.80 * 10.60/3.80 * Java Collections Framework. 10.60/3.80 * 10.60/3.80 * @author Josh Bloch 10.60/3.80 * @author Neal Gafter 10.60/3.80 * @see Collection 10.60/3.80 * @see Set 10.60/3.80 * @see ArrayList 10.60/3.80 * @see LinkedList 10.60/3.80 * @see Vector 10.60/3.80 * @see Arrays#asList(Object[]) 10.60/3.80 * @see Collections#nCopies(int, Object) 10.60/3.80 * @see Collections#EMPTY_LIST 10.60/3.80 * @see AbstractList 10.60/3.80 * @see AbstractSequentialList 10.60/3.80 * @since 1.2 10.60/3.80 */ 10.60/3.80 10.60/3.80 public interface List extends Collection { 10.60/3.80 // Query Operations 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns the number of elements in this list. If this list contains 10.60/3.80 * more than Integer.MAX_VALUE elements, returns 10.60/3.80 * Integer.MAX_VALUE. 10.60/3.80 * 10.60/3.80 * @return the number of elements in this list 10.60/3.80 */ 10.60/3.80 int size(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns true if this list contains no elements. 10.60/3.80 * 10.60/3.80 * @return true if this list contains no elements 10.60/3.80 */ 10.60/3.80 boolean isEmpty(); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns true if this list contains the specified element. 10.60/3.80 * More formally, returns true if and only if this list contains 10.60/3.80 * at least one element e such that 10.60/3.80 * (o==null ? e==null : o.equals(e)). 10.60/3.80 * 10.60/3.80 * @param o element whose presence in this list is to be tested 10.60/3.80 * @return true if this list contains the specified element 10.60/3.80 * @throws ClassCastException if the type of the specified element 10.60/3.80 * is incompatible with this list (optional) 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * list does not permit null elements (optional) 10.60/3.80 */ 10.60/3.80 boolean contains(Object o); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns an iterator over the elements in this list in proper sequence. 10.60/3.80 * 10.60/3.80 * @return an iterator over the elements in this list in proper sequence 10.60/3.80 */ 10.60/3.80 Iterator iterator(); 10.60/3.80 10.60/3.80 // Modification Operations 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Appends the specified element to the end of this list (optional 10.60/3.80 * operation). 10.60/3.80 * 10.60/3.80 *

Lists that support this operation may place limitations on what 10.60/3.80 * elements may be added to this list. In particular, some 10.60/3.80 * lists will refuse to add null elements, and others will impose 10.60/3.80 * restrictions on the type of elements that may be added. List 10.60/3.80 * classes should clearly specify in their documentation any restrictions 10.60/3.80 * on what elements may be added. 10.60/3.80 * 10.60/3.80 * @param e element to be appended to this list 10.60/3.80 * @return true (as specified by {@link Collection#add}) 10.60/3.80 * @throws UnsupportedOperationException if the add operation 10.60/3.80 * is not supported by this list 10.60/3.80 * @throws ClassCastException if the class of the specified element 10.60/3.80 * prevents it from being added to this list 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * list does not permit null elements 10.60/3.80 * @throws IllegalArgumentException if some property of this element 10.60/3.80 * prevents it from being added to this list 10.60/3.80 */ 10.60/3.80 boolean add(E e); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes the first occurrence of the specified element from this list, 10.60/3.80 * if it is present (optional operation). If this list does not contain 10.60/3.80 * the element, it is unchanged. More formally, removes the element with 10.60/3.80 * the lowest index i such that 10.60/3.80 * (o==null ? get(i)==null : o.equals(get(i))) 10.60/3.80 * (if such an element exists). Returns true if this list 10.60/3.80 * contained the specified element (or equivalently, if this list changed 10.60/3.80 * as a result of the call). 10.60/3.80 * 10.60/3.80 * @param o element to be removed from this list, if present 10.60/3.80 * @return true if this list contained the specified element 10.60/3.80 * @throws ClassCastException if the type of the specified element 10.60/3.80 * is incompatible with this list (optional) 10.60/3.80 * @throws NullPointerException if the specified element is null and this 10.60/3.80 * list does not permit null elements (optional) 10.60/3.80 * @throws UnsupportedOperationException if the remove operation 10.60/3.80 * is not supported by this list 10.60/3.80 */ 10.60/3.80 boolean remove(Object o); 10.60/3.80 10.60/3.80 10.60/3.80 // Bulk Modification Operations 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Returns true if this list contains all of the elements of the 10.60/3.80 * specified collection. 10.60/3.80 * 10.60/3.80 * @param c collection to be checked for containment in this list 10.60/3.80 * @return true if this list contains all of the elements of the 10.60/3.80 * specified collection 10.60/3.80 * @throws ClassCastException if the types of one or more elements 10.60/3.80 * in the specified collection are incompatible with this 10.60/3.80 * list (optional) 10.60/3.80 * @throws NullPointerException if the specified collection contains one 10.60/3.80 * or more null elements and this list does not permit null 10.60/3.80 * elements (optional), or if the specified collection is null 10.60/3.80 * @see #contains(Object) 10.60/3.80 */ 10.60/3.80 boolean containsAll(Collection c); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Appends all of the elements in the specified collection to the end of 10.60/3.80 * this list, in the order that they are returned by the specified 10.60/3.80 * collection's iterator (optional operation). The behavior of this 10.60/3.80 * operation is undefined if the specified collection is modified while 10.60/3.80 * the operation is in progress. (Note that this will occur if the 10.60/3.80 * specified collection is this list, and it's nonempty.) 10.60/3.80 * 10.60/3.80 * @param c collection containing elements to be added to this list 10.60/3.80 * @return true if this list changed as a result of the call 10.60/3.80 * @throws UnsupportedOperationException if the addAll operation 10.60/3.80 * is not supported by this list 10.60/3.80 * @throws ClassCastException if the class of an element of the specified 10.60/3.80 * collection prevents it from being added to this list 10.60/3.80 * @throws NullPointerException if the specified collection contains one 10.60/3.80 * or more null elements and this list does not permit null 10.60/3.80 * elements, or if the specified collection is null 10.60/3.80 * @throws IllegalArgumentException if some property of an element of the 10.60/3.80 * specified collection prevents it from being added to this list 10.60/3.80 * @see #add(Object) 10.60/3.80 */ 10.60/3.80 boolean addAll(Collection c); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Inserts all of the elements in the specified collection into this 10.60/3.80 * list at the specified position (optional operation). Shifts the 10.60/3.80 * element currently at that position (if any) and any subsequent 10.60/3.80 * elements to the right (increases their indices). The new elements 10.60/3.80 * will appear in this list in the order that they are returned by the 10.60/3.80 * specified collection's iterator. The behavior of this operation is 10.60/3.80 * undefined if the specified collection is modified while the 10.60/3.80 * operation is in progress. (Note that this will occur if the specified 10.60/3.80 * collection is this list, and it's nonempty.) 10.60/3.80 * 10.60/3.80 * @param index index at which to insert the first element from the 10.60/3.80 * specified collection 10.60/3.80 * @param c collection containing elements to be added to this list 10.60/3.80 * @return true if this list changed as a result of the call 10.60/3.80 * @throws UnsupportedOperationException if the addAll operation 10.60/3.80 * is not supported by this list 10.60/3.80 * @throws ClassCastException if the class of an element of the specified 10.60/3.80 * collection prevents it from being added to this list 10.60/3.80 * @throws NullPointerException if the specified collection contains one 10.60/3.80 * or more null elements and this list does not permit null 10.60/3.80 * elements, or if the specified collection is null 10.60/3.80 * @throws IllegalArgumentException if some property of an element of the 10.60/3.80 * specified collection prevents it from being added to this list 10.60/3.80 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.80 * (index < 0 || index > size()) 10.60/3.80 */ 10.60/3.80 boolean addAll(int index, Collection c); 10.60/3.80 10.60/3.80 /** 10.60/3.80 * Removes from this list all of its elements that are contained in the 10.60/3.80 * specified collection (optional operation). 10.60/3.80 * 10.60/3.80 * @param c collection containing elements to be removed from this list 10.60/3.80 * @return true if this list changed as a result of the call 10.60/3.80 * @throws UnsupportedOperationException if the removeAll operation 10.60/3.80 * is not supported by this list 10.60/3.81 * @throws ClassCastException if the class of an element of this list 10.60/3.81 * is incompatible with the specified collection (optional) 10.60/3.81 * @throws NullPointerException if this list contains a null element and the 10.60/3.81 * specified collection does not permit null elements (optional), 10.60/3.81 * or if the specified collection is null 10.60/3.81 * @see #remove(Object) 10.60/3.81 * @see #contains(Object) 10.60/3.81 */ 10.60/3.81 boolean removeAll(Collection c); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Retains only the elements in this list that are contained in the 10.60/3.81 * specified collection (optional operation). In other words, removes 10.60/3.81 * from this list all of its elements that are not contained in the 10.60/3.81 * specified collection. 10.60/3.81 * 10.60/3.81 * @param c collection containing elements to be retained in this list 10.60/3.81 * @return true if this list changed as a result of the call 10.60/3.81 * @throws UnsupportedOperationException if the retainAll operation 10.60/3.81 * is not supported by this list 10.60/3.81 * @throws ClassCastException if the class of an element of this list 10.60/3.81 * is incompatible with the specified collection (optional) 10.60/3.81 * @throws NullPointerException if this list contains a null element and the 10.60/3.81 * specified collection does not permit null elements (optional), 10.60/3.81 * or if the specified collection is null 10.60/3.81 * @see #remove(Object) 10.60/3.81 * @see #contains(Object) 10.60/3.81 */ 10.60/3.81 boolean retainAll(Collection c); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Removes all of the elements from this list (optional operation). 10.60/3.81 * The list will be empty after this call returns. 10.60/3.81 * 10.60/3.81 * @throws UnsupportedOperationException if the clear operation 10.60/3.81 * is not supported by this list 10.60/3.81 */ 10.60/3.81 void clear(); 10.60/3.81 10.60/3.81 10.60/3.81 // Comparison and hashing 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Compares the specified object with this list for equality. Returns 10.60/3.81 * true if and only if the specified object is also a list, both 10.60/3.81 * lists have the same size, and all corresponding pairs of elements in 10.60/3.81 * the two lists are equal. (Two elements e1 and 10.60/3.81 * e2 are equal if (e1==null ? e2==null : 10.60/3.81 * e1.equals(e2)).) In other words, two lists are defined to be 10.60/3.81 * equal if they contain the same elements in the same order. This 10.60/3.81 * definition ensures that the equals method works properly across 10.60/3.81 * different implementations of the List interface. 10.60/3.81 * 10.60/3.81 * @param o the object to be compared for equality with this list 10.60/3.81 * @return true if the specified object is equal to this list 10.60/3.81 */ 10.60/3.81 boolean equals(Object o); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Returns the hash code value for this list. The hash code of a list 10.60/3.81 * is defined to be the result of the following calculation: 10.60/3.81 *

10.60/3.81	     *  int hashCode = 1;
10.60/3.81	     *  for (E e : list)
10.60/3.81	     *      hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
10.60/3.81	     * 
10.60/3.81 * This ensures that list1.equals(list2) implies that 10.60/3.81 * list1.hashCode()==list2.hashCode() for any two lists, 10.60/3.81 * list1 and list2, as required by the general 10.60/3.81 * contract of {@link Object#hashCode}. 10.60/3.81 * 10.60/3.81 * @return the hash code value for this list 10.60/3.81 * @see Object#equals(Object) 10.60/3.81 * @see #equals(Object) 10.60/3.81 */ 10.60/3.81 int hashCode(); 10.60/3.81 10.60/3.81 10.60/3.81 // Positional Access Operations 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Returns the element at the specified position in this list. 10.60/3.81 * 10.60/3.81 * @param index index of the element to return 10.60/3.81 * @return the element at the specified position in this list 10.60/3.81 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.81 * (index < 0 || index >= size()) 10.60/3.81 */ 10.60/3.81 E get(int index); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Replaces the element at the specified position in this list with the 10.60/3.81 * specified element (optional operation). 10.60/3.81 * 10.60/3.81 * @param index index of the element to replace 10.60/3.81 * @param element element to be stored at the specified position 10.60/3.81 * @return the element previously at the specified position 10.60/3.81 * @throws UnsupportedOperationException if the set operation 10.60/3.81 * is not supported by this list 10.60/3.81 * @throws ClassCastException if the class of the specified element 10.60/3.81 * prevents it from being added to this list 10.60/3.81 * @throws NullPointerException if the specified element is null and 10.60/3.81 * this list does not permit null elements 10.60/3.81 * @throws IllegalArgumentException if some property of the specified 10.60/3.81 * element prevents it from being added to this list 10.60/3.81 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.81 * (index < 0 || index >= size()) 10.60/3.81 */ 10.60/3.81 E set(int index, E element); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Inserts the specified element at the specified position in this list 10.60/3.81 * (optional operation). Shifts the element currently at that position 10.60/3.81 * (if any) and any subsequent elements to the right (adds one to their 10.60/3.81 * indices). 10.60/3.81 * 10.60/3.81 * @param index index at which the specified element is to be inserted 10.60/3.81 * @param element element to be inserted 10.60/3.81 * @throws UnsupportedOperationException if the add operation 10.60/3.81 * is not supported by this list 10.60/3.81 * @throws ClassCastException if the class of the specified element 10.60/3.81 * prevents it from being added to this list 10.60/3.81 * @throws NullPointerException if the specified element is null and 10.60/3.81 * this list does not permit null elements 10.60/3.81 * @throws IllegalArgumentException if some property of the specified 10.60/3.81 * element prevents it from being added to this list 10.60/3.81 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.81 * (index < 0 || index > size()) 10.60/3.81 */ 10.60/3.81 void add(int index, E element); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Removes the element at the specified position in this list (optional 10.60/3.81 * operation). Shifts any subsequent elements to the left (subtracts one 10.60/3.81 * from their indices). Returns the element that was removed from the 10.60/3.81 * list. 10.60/3.81 * 10.60/3.81 * @param index the index of the element to be removed 10.60/3.81 * @return the element previously at the specified position 10.60/3.81 * @throws UnsupportedOperationException if the remove operation 10.60/3.81 * is not supported by this list 10.60/3.81 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.81 * (index < 0 || index >= size()) 10.60/3.81 */ 10.60/3.81 E remove(int index); 10.60/3.81 10.60/3.81 10.60/3.81 // Search Operations 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Returns the index of the first occurrence of the specified element 10.60/3.81 * in this list, or -1 if this list does not contain the element. 10.60/3.81 * More formally, returns the lowest index i such that 10.60/3.81 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.81 * or -1 if there is no such index. 10.60/3.81 * 10.60/3.81 * @param o element to search for 10.60/3.81 * @return the index of the first occurrence of the specified element in 10.60/3.81 * this list, or -1 if this list does not contain the element 10.60/3.81 * @throws ClassCastException if the type of the specified element 10.60/3.81 * is incompatible with this list (optional) 10.60/3.81 * @throws NullPointerException if the specified element is null and this 10.60/3.81 * list does not permit null elements (optional) 10.60/3.81 */ 10.60/3.81 int indexOf(Object o); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Returns the index of the last occurrence of the specified element 10.60/3.81 * in this list, or -1 if this list does not contain the element. 10.60/3.81 * More formally, returns the highest index i such that 10.60/3.81 * (o==null ? get(i)==null : o.equals(get(i))), 10.60/3.81 * or -1 if there is no such index. 10.60/3.81 * 10.60/3.81 * @param o element to search for 10.60/3.81 * @return the index of the last occurrence of the specified element in 10.60/3.81 * this list, or -1 if this list does not contain the element 10.60/3.81 * @throws ClassCastException if the type of the specified element 10.60/3.81 * is incompatible with this list (optional) 10.60/3.81 * @throws NullPointerException if the specified element is null and this 10.60/3.81 * list does not permit null elements (optional) 10.60/3.81 */ 10.60/3.81 int lastIndexOf(Object o); 10.60/3.81 10.60/3.81 10.60/3.81 // List Iterators 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Returns a list iterator over the elements in this list (in proper 10.60/3.81 * sequence). 10.60/3.81 * 10.60/3.81 * @return a list iterator over the elements in this list (in proper 10.60/3.81 * sequence) 10.60/3.81 */ 10.60/3.81 ListIterator listIterator(); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Returns a list iterator over the elements in this list (in proper 10.60/3.81 * sequence), starting at the specified position in the list. 10.60/3.81 * The specified index indicates the first element that would be 10.60/3.81 * returned by an initial call to {@link ListIterator#next next}. 10.60/3.81 * An initial call to {@link ListIterator#previous previous} would 10.60/3.81 * return the element with the specified index minus one. 10.60/3.81 * 10.60/3.81 * @param index index of the first element to be returned from the 10.60/3.81 * list iterator (by a call to {@link ListIterator#next next}) 10.60/3.81 * @return a list iterator over the elements in this list (in proper 10.60/3.81 * sequence), starting at the specified position in the list 10.60/3.81 * @throws IndexOutOfBoundsException if the index is out of range 10.60/3.81 * ({@code index < 0 || index > size()}) 10.60/3.81 */ 10.60/3.81 ListIterator listIterator(int index); 10.60/3.81 10.60/3.81 // View 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Returns a view of the portion of this list between the specified 10.60/3.81 * fromIndex, inclusive, and toIndex, exclusive. (If 10.60/3.81 * fromIndex and toIndex are equal, the returned list is 10.60/3.81 * empty.) The returned list is backed by this list, so non-structural 10.60/3.81 * changes in the returned list are reflected in this list, and vice-versa. 10.60/3.81 * The returned list supports all of the optional list operations supported 10.60/3.81 * by this list.

10.60/3.81 * 10.60/3.81 * This method eliminates the need for explicit range operations (of 10.60/3.81 * the sort that commonly exist for arrays). Any operation that expects 10.60/3.81 * a list can be used as a range operation by passing a subList view 10.60/3.81 * instead of a whole list. For example, the following idiom 10.60/3.81 * removes a range of elements from a list: 10.60/3.81 *

10.60/3.81	     *      list.subList(from, to).clear();
10.60/3.81	     * 
10.60/3.81 * Similar idioms may be constructed for indexOf and 10.60/3.81 * lastIndexOf, and all of the algorithms in the 10.60/3.81 * Collections class can be applied to a subList.

10.60/3.81 * 10.60/3.81 * The semantics of the list returned by this method become undefined if 10.60/3.81 * the backing list (i.e., this list) is structurally modified in 10.60/3.81 * any way other than via the returned list. (Structural modifications are 10.60/3.81 * those that change the size of this list, or otherwise perturb it in such 10.60/3.81 * a fashion that iterations in progress may yield incorrect results.) 10.60/3.81 * 10.60/3.81 * @param fromIndex low endpoint (inclusive) of the subList 10.60/3.81 * @param toIndex high endpoint (exclusive) of the subList 10.60/3.81 * @return a view of the specified range within this list 10.60/3.81 * @throws IndexOutOfBoundsException for an illegal endpoint index value 10.60/3.81 * (fromIndex < 0 || toIndex > size || 10.60/3.81 * fromIndex > toIndex) 10.60/3.81 */ 10.60/3.81 List subList(int fromIndex, int toIndex); 10.60/3.81 } 10.60/3.81 10.60/3.81 10.60/3.81 /* 10.60/3.81 * Copyright 1994-1998 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.81 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.81 * 10.60/3.81 * This code is free software; you can redistribute it and/or modify it 10.60/3.81 * under the terms of the GNU General Public License version 2 only, as 10.60/3.81 * published by the Free Software Foundation. Sun designates this 10.60/3.81 * particular file as subject to the "Classpath" exception as provided 10.60/3.81 * by Sun in the LICENSE file that accompanied this code. 10.60/3.81 * 10.60/3.81 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.81 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.81 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.81 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.81 * accompanied this code). 10.60/3.81 * 10.60/3.81 * You should have received a copy of the GNU General Public License version 10.60/3.81 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.81 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.81 * 10.60/3.81 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.81 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.81 * have any questions. 10.60/3.81 */ 10.60/3.81 10.60/3.81 package javaUtilEx; 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Thrown by the nextElement method of an 10.60/3.81 * Enumeration to indicate that there are no more 10.60/3.81 * elements in the enumeration. 10.60/3.81 * 10.60/3.81 * @author unascribed 10.60/3.81 * @see java.util.Enumeration 10.60/3.81 * @see java.util.Enumeration#nextElement() 10.60/3.81 * @since JDK1.0 10.60/3.81 */ 10.60/3.81 public 10.60/3.81 class NoSuchElementException extends RuntimeException { 10.60/3.81 /** 10.60/3.81 * Constructs a NoSuchElementException with null 10.60/3.81 * as its error message string. 10.60/3.81 */ 10.60/3.81 public NoSuchElementException() { 10.60/3.81 super(); 10.60/3.81 } 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Constructs a NoSuchElementException, saving a reference 10.60/3.81 * to the error message string s for later retrieval by the 10.60/3.81 * getMessage method. 10.60/3.81 * 10.60/3.81 * @param s the detail message. 10.60/3.81 */ 10.60/3.81 public NoSuchElementException(String s) { 10.60/3.81 super(s); 10.60/3.81 } 10.60/3.81 } 10.60/3.81 10.60/3.81 10.60/3.81 /* 10.60/3.81 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.81 * 10.60/3.81 * This code is free software; you can redistribute it and/or modify it 10.60/3.81 * under the terms of the GNU General Public License version 2 only, as 10.60/3.81 * published by the Free Software Foundation. Sun designates this 10.60/3.81 * particular file as subject to the "Classpath" exception as provided 10.60/3.81 * by Sun in the LICENSE file that accompanied this code. 10.60/3.81 * 10.60/3.81 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.81 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.81 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.81 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.81 * accompanied this code). 10.60/3.81 * 10.60/3.81 * You should have received a copy of the GNU General Public License version 10.60/3.81 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.81 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.81 * 10.60/3.81 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.81 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.81 * have any questions. 10.60/3.81 */ 10.60/3.81 10.60/3.81 /* 10.60/3.81 * This file is available under and governed by the GNU General Public 10.60/3.81 * License version 2 only, as published by the Free Software Foundation. 10.60/3.81 * However, the following notice accompanied the original version of this 10.60/3.81 * file: 10.60/3.81 * 10.60/3.81 * Written by Doug Lea with assistance from members of JCP JSR-166 10.60/3.81 * Expert Group and released to the public domain, as explained at 10.60/3.81 * http://creativecommons.org/licenses/publicdomain 10.60/3.81 */ 10.60/3.81 10.60/3.81 package javaUtilEx; 10.60/3.81 10.60/3.81 /** 10.60/3.81 * A collection designed for holding elements prior to processing. 10.60/3.81 * Besides basic {@link java.util.Collection Collection} operations, 10.60/3.81 * queues provide additional insertion, extraction, and inspection 10.60/3.81 * operations. Each of these methods exists in two forms: one throws 10.60/3.81 * an exception if the operation fails, the other returns a special 10.60/3.81 * value (either null or false, depending on the 10.60/3.81 * operation). The latter form of the insert operation is designed 10.60/3.81 * specifically for use with capacity-restricted Queue 10.60/3.81 * implementations; in most implementations, insert operations cannot 10.60/3.81 * fail. 10.60/3.81 * 10.60/3.81 *

10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 * 10.60/3.81 *
Throws exceptionReturns special value
Insert{@link #add add(e)}{@link #offer offer(e)}
Remove{@link #remove remove()}{@link #poll poll()}
Examine{@link #element element()}{@link #peek peek()}
10.60/3.81 * 10.60/3.81 *

Queues typically, but do not necessarily, order elements in a 10.60/3.81 * FIFO (first-in-first-out) manner. Among the exceptions are 10.60/3.81 * priority queues, which order elements according to a supplied 10.60/3.81 * comparator, or the elements' natural ordering, and LIFO queues (or 10.60/3.81 * stacks) which order the elements LIFO (last-in-first-out). 10.60/3.81 * Whatever the ordering used, the head of the queue is that 10.60/3.81 * element which would be removed by a call to {@link #remove() } or 10.60/3.81 * {@link #poll()}. In a FIFO queue, all new elements are inserted at 10.60/3.81 * the tail of the queue. Other kinds of queues may use 10.60/3.81 * different placement rules. Every Queue implementation 10.60/3.81 * must specify its ordering properties. 10.60/3.81 * 10.60/3.81 *

The {@link #offer offer} method inserts an element if possible, 10.60/3.81 * otherwise returning false. This differs from the {@link 10.60/3.81 * java.util.Collection#add Collection.add} method, which can fail to 10.60/3.81 * add an element only by throwing an unchecked exception. The 10.60/3.81 * offer method is designed for use when failure is a normal, 10.60/3.81 * rather than exceptional occurrence, for example, in fixed-capacity 10.60/3.81 * (or "bounded") queues. 10.60/3.81 * 10.60/3.81 *

The {@link #remove()} and {@link #poll()} methods remove and 10.60/3.81 * return the head of the queue. 10.60/3.81 * Exactly which element is removed from the queue is a 10.60/3.81 * function of the queue's ordering policy, which differs from 10.60/3.81 * implementation to implementation. The remove() and 10.60/3.81 * poll() methods differ only in their behavior when the 10.60/3.81 * queue is empty: the remove() method throws an exception, 10.60/3.81 * while the poll() method returns null. 10.60/3.81 * 10.60/3.81 *

The {@link #element()} and {@link #peek()} methods return, but do 10.60/3.81 * not remove, the head of the queue. 10.60/3.81 * 10.60/3.81 *

The Queue interface does not define the blocking queue 10.60/3.81 * methods, which are common in concurrent programming. These methods, 10.60/3.81 * which wait for elements to appear or for space to become available, are 10.60/3.81 * defined in the {@link java.util.concurrent.BlockingQueue} interface, which 10.60/3.81 * extends this interface. 10.60/3.81 * 10.60/3.81 *

Queue implementations generally do not allow insertion 10.60/3.81 * of null elements, although some implementations, such as 10.60/3.81 * {@link LinkedList}, do not prohibit insertion of null. 10.60/3.81 * Even in the implementations that permit it, null should 10.60/3.81 * not be inserted into a Queue, as null is also 10.60/3.81 * used as a special return value by the poll method to 10.60/3.81 * indicate that the queue contains no elements. 10.60/3.81 * 10.60/3.81 *

Queue implementations generally do not define 10.60/3.81 * element-based versions of methods equals and 10.60/3.81 * hashCode but instead inherit the identity based versions 10.60/3.81 * from class Object, because element-based equality is not 10.60/3.81 * always well-defined for queues with the same elements but different 10.60/3.81 * ordering properties. 10.60/3.81 * 10.60/3.81 * 10.60/3.81 *

This interface is a member of the 10.60/3.81 * 10.60/3.81 * Java Collections Framework. 10.60/3.81 * 10.60/3.81 * @see java.util.Collection 10.60/3.81 * @see LinkedList 10.60/3.81 * @see PriorityQueue 10.60/3.81 * @see java.util.concurrent.LinkedBlockingQueue 10.60/3.81 * @see java.util.concurrent.BlockingQueue 10.60/3.81 * @see java.util.concurrent.ArrayBlockingQueue 10.60/3.81 * @see java.util.concurrent.LinkedBlockingQueue 10.60/3.81 * @see java.util.concurrent.PriorityBlockingQueue 10.60/3.81 * @since 1.5 10.60/3.81 * @author Doug Lea 10.60/3.81 * @param the type of elements held in this collection 10.60/3.81 */ 10.60/3.81 public interface Queue extends Collection { 10.60/3.81 /** 10.60/3.81 * Inserts the specified element into this queue if it is possible to do so 10.60/3.81 * immediately without violating capacity restrictions, returning 10.60/3.81 * true upon success and throwing an IllegalStateException 10.60/3.81 * if no space is currently available. 10.60/3.81 * 10.60/3.81 * @param e the element to add 10.60/3.81 * @return true (as specified by {@link Collection#add}) 10.60/3.81 * @throws IllegalStateException if the element cannot be added at this 10.60/3.81 * time due to capacity restrictions 10.60/3.81 * @throws ClassCastException if the class of the specified element 10.60/3.81 * prevents it from being added to this queue 10.60/3.81 * @throws NullPointerException if the specified element is null and 10.60/3.81 * this queue does not permit null elements 10.60/3.81 * @throws IllegalArgumentException if some property of this element 10.60/3.81 * prevents it from being added to this queue 10.60/3.81 */ 10.60/3.81 boolean add(E e); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Inserts the specified element into this queue if it is possible to do 10.60/3.81 * so immediately without violating capacity restrictions. 10.60/3.81 * When using a capacity-restricted queue, this method is generally 10.60/3.81 * preferable to {@link #add}, which can fail to insert an element only 10.60/3.81 * by throwing an exception. 10.60/3.81 * 10.60/3.81 * @param e the element to add 10.60/3.81 * @return true if the element was added to this queue, else 10.60/3.81 * false 10.60/3.81 * @throws ClassCastException if the class of the specified element 10.60/3.81 * prevents it from being added to this queue 10.60/3.81 * @throws NullPointerException if the specified element is null and 10.60/3.81 * this queue does not permit null elements 10.60/3.81 * @throws IllegalArgumentException if some property of this element 10.60/3.81 * prevents it from being added to this queue 10.60/3.81 */ 10.60/3.81 boolean offer(E e); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Retrieves and removes the head of this queue. This method differs 10.60/3.81 * from {@link #poll poll} only in that it throws an exception if this 10.60/3.81 * queue is empty. 10.60/3.81 * 10.60/3.81 * @return the head of this queue 10.60/3.81 * @throws NoSuchElementException if this queue is empty 10.60/3.81 */ 10.60/3.81 E remove(); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Retrieves and removes the head of this queue, 10.60/3.81 * or returns null if this queue is empty. 10.60/3.81 * 10.60/3.81 * @return the head of this queue, or null if this queue is empty 10.60/3.81 */ 10.60/3.81 E poll(); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Retrieves, but does not remove, the head of this queue. This method 10.60/3.81 * differs from {@link #peek peek} only in that it throws an exception 10.60/3.81 * if this queue is empty. 10.60/3.81 * 10.60/3.81 * @return the head of this queue 10.60/3.81 * @throws NoSuchElementException if this queue is empty 10.60/3.81 */ 10.60/3.81 E element(); 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Retrieves, but does not remove, the head of this queue, 10.60/3.81 * or returns null if this queue is empty. 10.60/3.81 * 10.60/3.81 * @return the head of this queue, or null if this queue is empty 10.60/3.81 */ 10.60/3.81 E peek(); 10.60/3.81 } 10.60/3.81 10.60/3.81 10.60/3.81 /* 10.60/3.81 * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.81 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.81 * 10.60/3.81 * This code is free software; you can redistribute it and/or modify it 10.60/3.81 * under the terms of the GNU General Public License version 2 only, as 10.60/3.81 * published by the Free Software Foundation. Sun designates this 10.60/3.81 * particular file as subject to the "Classpath" exception as provided 10.60/3.81 * by Sun in the LICENSE file that accompanied this code. 10.60/3.81 * 10.60/3.81 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.81 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.81 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.81 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.81 * accompanied this code). 10.60/3.81 * 10.60/3.81 * You should have received a copy of the GNU General Public License version 10.60/3.81 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.81 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.81 * 10.60/3.81 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.81 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.81 * have any questions. 10.60/3.81 */ 10.60/3.81 10.60/3.81 package javaUtilEx; 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Marker interface used by List implementations to indicate that 10.60/3.81 * they support fast (generally constant time) random access. The primary 10.60/3.81 * purpose of this interface is to allow generic algorithms to alter their 10.60/3.81 * behavior to provide good performance when applied to either random or 10.60/3.81 * sequential access lists. 10.60/3.81 * 10.60/3.81 *

The best algorithms for manipulating random access lists (such as 10.60/3.81 * ArrayList) can produce quadratic behavior when applied to 10.60/3.81 * sequential access lists (such as LinkedList). Generic list 10.60/3.81 * algorithms are encouraged to check whether the given list is an 10.60/3.81 * instanceof this interface before applying an algorithm that would 10.60/3.81 * provide poor performance if it were applied to a sequential access list, 10.60/3.81 * and to alter their behavior if necessary to guarantee acceptable 10.60/3.81 * performance. 10.60/3.81 * 10.60/3.81 *

It is recognized that the distinction between random and sequential 10.60/3.81 * access is often fuzzy. For example, some List implementations 10.60/3.81 * provide asymptotically linear access times if they get huge, but constant 10.60/3.81 * access times in practice. Such a List implementation 10.60/3.81 * should generally implement this interface. As a rule of thumb, a 10.60/3.81 * List implementation should implement this interface if, 10.60/3.81 * for typical instances of the class, this loop: 10.60/3.81 *

10.60/3.81	 *     for (int i=0, n=list.size(); i < n; i++)
10.60/3.81	 *         list.get(i);
10.60/3.81	 * 
10.60/3.81 * runs faster than this loop: 10.60/3.81 *
10.60/3.81	 *     for (Iterator i=list.iterator(); i.hasNext(); )
10.60/3.81	 *         i.next();
10.60/3.81	 * 
10.60/3.81 * 10.60/3.81 *

This interface is a member of the 10.60/3.81 * 10.60/3.81 * Java Collections Framework. 10.60/3.81 * 10.60/3.81 * @since 1.4 10.60/3.81 */ 10.60/3.81 public interface RandomAccess { 10.60/3.81 } 10.60/3.81 10.60/3.81 10.60/3.81 package javaUtilEx; 10.60/3.81 10.60/3.81 public class Random { 10.60/3.81 static String[] args; 10.60/3.81 static int index = 0; 10.60/3.81 10.60/3.81 public static int random() { 10.60/3.81 String string = args[index]; 10.60/3.81 index++; 10.60/3.81 return string.length(); 10.60/3.81 } 10.60/3.81 } 10.60/3.81 10.60/3.81 10.60/3.81 /* 10.60/3.81 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. 10.60/3.81 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.60/3.81 * 10.60/3.81 * This code is free software; you can redistribute it and/or modify it 10.60/3.81 * under the terms of the GNU General Public License version 2 only, as 10.60/3.81 * published by the Free Software Foundation. Sun designates this 10.60/3.81 * particular file as subject to the "Classpath" exception as provided 10.60/3.81 * by Sun in the LICENSE file that accompanied this code. 10.60/3.81 * 10.60/3.81 * This code is distributed in the hope that it will be useful, but WITHOUT 10.60/3.81 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.60/3.81 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.60/3.81 * version 2 for more details (a copy is included in the LICENSE file that 10.60/3.81 * accompanied this code). 10.60/3.81 * 10.60/3.81 * You should have received a copy of the GNU General Public License version 10.60/3.81 * 2 along with this work; if not, write to the Free Software Foundation, 10.60/3.81 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.60/3.81 * 10.60/3.81 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.60/3.81 * CA 95054 USA or visit www.sun.com if you need additional information or 10.60/3.81 * have any questions. 10.60/3.81 */ 10.60/3.81 10.60/3.81 package javaUtilEx; 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Thrown to indicate that the requested operation is not supported.

10.60/3.81 * 10.60/3.81 * This class is a member of the 10.60/3.81 * 10.60/3.81 * Java Collections Framework. 10.60/3.81 * 10.60/3.81 * @author Josh Bloch 10.60/3.81 * @since 1.2 10.60/3.81 */ 10.60/3.81 public class UnsupportedOperationException extends RuntimeException { 10.60/3.81 /** 10.60/3.81 * Constructs an UnsupportedOperationException with no detail message. 10.60/3.81 */ 10.60/3.81 public UnsupportedOperationException() { 10.60/3.81 } 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Constructs an UnsupportedOperationException with the specified 10.60/3.81 * detail message. 10.60/3.81 * 10.60/3.81 * @param message the detail message 10.60/3.81 */ 10.60/3.81 public UnsupportedOperationException(String message) { 10.60/3.81 super(message); 10.60/3.81 } 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Constructs a new exception with the specified detail message and 10.60/3.81 * cause. 10.60/3.81 * 10.60/3.81 *

Note that the detail message associated with cause is 10.60/3.81 * not automatically incorporated in this exception's detail 10.60/3.81 * message. 10.60/3.81 * 10.60/3.81 * @param message the detail message (which is saved for later retrieval 10.60/3.81 * by the {@link Throwable#getMessage()} method). 10.60/3.81 * @param cause the cause (which is saved for later retrieval by the 10.60/3.81 * {@link Throwable#getCause()} method). (A null value 10.60/3.81 * is permitted, and indicates that the cause is nonexistent or 10.60/3.81 * unknown.) 10.60/3.81 * @since 1.5 10.60/3.81 */ 10.60/3.81 public UnsupportedOperationException(String message, Throwable cause) { 10.60/3.81 super(message, cause); 10.60/3.81 } 10.60/3.81 10.60/3.81 /** 10.60/3.81 * Constructs a new exception with the specified cause and a detail 10.60/3.81 * message of (cause==null ? null : cause.toString()) (which 10.60/3.81 * typically contains the class and detail message of cause). 10.60/3.81 * This constructor is useful for exceptions that are little more than 10.60/3.81 * wrappers for other throwables (for example, {@link 10.60/3.81 * java.security.PrivilegedActionException}). 10.60/3.81 * 10.60/3.81 * @param cause the cause (which is saved for later retrieval by the 10.60/3.81 * {@link Throwable#getCause()} method). (A null value is 10.60/3.81 * permitted, and indicates that the cause is nonexistent or 10.60/3.81 * unknown.) 10.60/3.81 * @since 1.5 10.60/3.81 */ 10.60/3.81 public UnsupportedOperationException(Throwable cause) { 10.60/3.81 super(cause); 10.60/3.81 } 10.60/3.81 10.60/3.81 static final long serialVersionUID = -1242599979055084673L; 10.60/3.81 } 10.60/3.81 10.60/3.81 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (3) JBCToGraph (EQUIVALENT) 10.60/3.81 Constructed TerminationGraph. 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (4) 10.60/3.81 Obligation: 10.60/3.81 Termination Graph based on JBC Program: 10.60/3.81 javaUtilEx.juLinkedListCreate.main([Ljava/lang/String;)V: Graph of 112 nodes with 0 SCCs. 10.60/3.81 10.60/3.81 10.60/3.81 10.60/3.81 javaUtilEx.juLinkedListCreate.createList(I)LjavaUtilEx/LinkedList;: Graph of 223 nodes with 1 SCC. 10.60/3.81 10.60/3.81 10.60/3.81 10.60/3.81 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (5) TerminationGraphToSCCProof (SOUND) 10.60/3.81 Splitted TerminationGraph to 1 SCCs. 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (6) 10.60/3.81 Obligation: 10.60/3.81 SCC of termination graph based on JBC Program. 10.60/3.81 SCC contains nodes from the following methods: javaUtilEx.juLinkedListCreate.createList(I)LjavaUtilEx/LinkedList; 10.60/3.81 SCC calls the following helper methods: 10.60/3.81 Performed SCC analyses: 10.60/3.81 *Used field analysis yielded the following read fields: 10.60/3.81 *java.lang.String: [count] 10.60/3.81 *javaUtilEx.LinkedList: [header, size] 10.60/3.81 *javaUtilEx.LinkedList$Entry: [next, previous] 10.60/3.81 *javaUtilEx.AbstractList: [modCount] 10.60/3.81 *Marker field analysis yielded the following relations that could be markers: 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (7) SCCToIRSProof (SOUND) 10.60/3.81 Transformed FIGraph SCCs to intTRSs. Log: 10.60/3.81 Generated rules. Obtained 93 IRulesP rules: 10.60/3.81 f2583_0_createList_LE(EOS(STATIC_2583(java.lang.Object(o490sub), i345)), i355, i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2585_0_createList_LE(EOS(STATIC_2585(java.lang.Object(o490sub), i345)), i355, i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2585_0_createList_LE(EOS(STATIC_2585(java.lang.Object(o490sub), i345)), i355, i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2587_0_createList_Load(EOS(STATIC_2587(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: i355 > 0 10.60/3.81 f2587_0_createList_Load(EOS(STATIC_2587(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2589_0_createList_New(EOS(STATIC_2589(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2589_0_createList_New(EOS(STATIC_2589(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2591_0_createList_Duplicate(EOS(STATIC_2591(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2591_0_createList_Duplicate(EOS(STATIC_2591(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2624_0_createList_InvokeMethod(EOS(STATIC_2624(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2624_0_createList_InvokeMethod(EOS(STATIC_2624(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2649_0_random_FieldAccess(EOS(STATIC_2649(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2649_0_random_FieldAccess(EOS(STATIC_2649(java.lang.Object(o490sub), i345)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2656_0_random_FieldAccess(EOS(STATIC_2656(java.lang.Object(o490sub), i345)), i355, java.lang.Object(o490sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2656_0_random_FieldAccess(EOS(STATIC_2656(java.lang.Object(o490sub), i345)), i355, java.lang.Object(o490sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2659_0_random_ArrayAccess(EOS(STATIC_2659(java.lang.Object(o490sub), i345)), i355, java.lang.Object(o490sub), i345, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2659_0_random_ArrayAccess(EOS(STATIC_2659(java.lang.Object(ARRAY(i377)), i345)), i355, java.lang.Object(ARRAY(i377)), i345, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2661_0_random_ArrayAccess(EOS(STATIC_2661(java.lang.Object(ARRAY(i377)), i345)), i355, java.lang.Object(ARRAY(i377)), i345, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: i377 >= 0 10.60/3.81 f2661_0_random_ArrayAccess(EOS(STATIC_2661(java.lang.Object(ARRAY(i377)), i379)), i355, java.lang.Object(ARRAY(i377)), i379, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2666_0_random_ArrayAccess(EOS(STATIC_2666(java.lang.Object(ARRAY(i377)), i379)), i355, java.lang.Object(ARRAY(i377)), i379, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2666_0_random_ArrayAccess(EOS(STATIC_2666(java.lang.Object(ARRAY(i377)), i379)), i355, java.lang.Object(ARRAY(i377)), i379, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2671_0_random_ArrayAccess(EOS(STATIC_2671(java.lang.Object(ARRAY(i377)), i379)), i355, java.lang.Object(ARRAY(i377)), i379, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2671_0_random_ArrayAccess(EOS(STATIC_2671(java.lang.Object(ARRAY(i377)), i379)), i355, java.lang.Object(ARRAY(i377)), i379, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2675_0_random_Store(EOS(STATIC_2675(java.lang.Object(ARRAY(i377)), i379)), i355, o526, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: i379 < i377 10.60/3.81 f2675_0_random_Store(EOS(STATIC_2675(java.lang.Object(ARRAY(i377)), i379)), i355, o526, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2681_0_random_FieldAccess(EOS(STATIC_2681(java.lang.Object(ARRAY(i377)), i379)), i355, o526, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2681_0_random_FieldAccess(EOS(STATIC_2681(java.lang.Object(ARRAY(i377)), i379)), i355, o526, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2686_0_random_ConstantStackPush(EOS(STATIC_2686(java.lang.Object(ARRAY(i377)), i379)), i355, o526, i379, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2686_0_random_ConstantStackPush(EOS(STATIC_2686(java.lang.Object(ARRAY(i377)), i379)), i355, o526, i379, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2688_0_random_IntArithmetic(EOS(STATIC_2688(java.lang.Object(ARRAY(i377)), i379)), i355, o526, i379, 1, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2688_0_random_IntArithmetic(EOS(STATIC_2688(java.lang.Object(ARRAY(i377)), i379)), i355, o526, i379, matching1, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2713_0_random_FieldAccess(EOS(STATIC_2713(java.lang.Object(ARRAY(i377)), i379)), i355, o526, i379 + 1, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: i379 >= 0 && matching1 = 1 10.60/3.81 f2713_0_random_FieldAccess(EOS(STATIC_2713(java.lang.Object(ARRAY(i377)), i379)), i355, o526, i380, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2719_0_random_Load(EOS(STATIC_2719(java.lang.Object(ARRAY(i377)), i380)), i355, o526, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2719_0_random_Load(EOS(STATIC_2719(java.lang.Object(ARRAY(i377)), i380)), i355, o526, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2725_0_random_InvokeMethod(EOS(STATIC_2725(java.lang.Object(ARRAY(i377)), i380)), i355, o526, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2725_0_random_InvokeMethod(EOS(STATIC_2725(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o528sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2733_0_random_InvokeMethod(EOS(STATIC_2733(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o528sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2733_0_random_InvokeMethod(EOS(STATIC_2733(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o529sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2739_0_random_InvokeMethod(EOS(STATIC_2739(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o529sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2739_0_random_InvokeMethod(EOS(STATIC_2739(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o529sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2749_0_length_Load(EOS(STATIC_2749(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o529sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2749_0_length_Load(EOS(STATIC_2749(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o529sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2759_0_length_FieldAccess(EOS(STATIC_2759(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(o529sub), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2759_0_length_FieldAccess(EOS(STATIC_2759(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(java.lang.String(EOC, i384)), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2762_0_length_FieldAccess(EOS(STATIC_2762(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(java.lang.String(EOC, i384)), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2762_0_length_FieldAccess(EOS(STATIC_2762(java.lang.Object(ARRAY(i377)), i380)), i355, java.lang.Object(java.lang.String(EOC, i384)), o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2765_0_length_Return(EOS(STATIC_2765(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2765_0_length_Return(EOS(STATIC_2765(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2771_0_random_Return(EOS(STATIC_2771(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2771_0_random_Return(EOS(STATIC_2771(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2775_0_createList_InvokeMethod(EOS(STATIC_2775(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2775_0_createList_InvokeMethod(EOS(STATIC_2775(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2778_0__init__Load(EOS(STATIC_2778(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2778_0__init__Load(EOS(STATIC_2778(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2785_0__init__InvokeMethod(EOS(STATIC_2785(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2785_0__init__InvokeMethod(EOS(STATIC_2785(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2797_0__init__Load(EOS(STATIC_2797(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2797_0__init__Load(EOS(STATIC_2797(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2801_0__init__Load(EOS(STATIC_2801(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2801_0__init__Load(EOS(STATIC_2801(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2805_0__init__FieldAccess(EOS(STATIC_2805(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2805_0__init__FieldAccess(EOS(STATIC_2805(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2809_0__init__Return(EOS(STATIC_2809(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2809_0__init__Return(EOS(STATIC_2809(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2813_0_createList_InvokeMethod(EOS(STATIC_2813(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2813_0_createList_InvokeMethod(EOS(STATIC_2813(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2817_0_addFirst_Load(EOS(STATIC_2817(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2817_0_addFirst_Load(EOS(STATIC_2817(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2824_0_addFirst_Load(EOS(STATIC_2824(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2824_0_addFirst_Load(EOS(STATIC_2824(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2828_0_addFirst_Load(EOS(STATIC_2828(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2828_0_addFirst_Load(EOS(STATIC_2828(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2835_0_addFirst_FieldAccess(EOS(STATIC_2835(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2835_0_addFirst_FieldAccess(EOS(STATIC_2835(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2843_0_addFirst_FieldAccess(EOS(STATIC_2843(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2843_0_addFirst_FieldAccess(EOS(STATIC_2843(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2846_0_addFirst_FieldAccess(EOS(STATIC_2846(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: o496[LinkedList$Entry.previous]o496 > 0 && o496[LinkedList$Entry.previous]o493 > 0 10.60/3.81 f2846_0_addFirst_FieldAccess(EOS(STATIC_2846(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2851_0_addFirst_FieldAccess(EOS(STATIC_2851(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: o495[LinkedList$Entry.next]o495 > 0 && o495[LinkedList$Entry.next]o493 > 0 10.60/3.81 f2851_0_addFirst_FieldAccess(EOS(STATIC_2851(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2854_0_addFirst_InvokeMethod(EOS(STATIC_2854(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2854_0_addFirst_InvokeMethod(EOS(STATIC_2854(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2856_0_addBefore_New(EOS(STATIC_2856(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2856_0_addBefore_New(EOS(STATIC_2856(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2858_0_addBefore_Duplicate(EOS(STATIC_2858(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2858_0_addBefore_Duplicate(EOS(STATIC_2858(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2859_0_addBefore_Load(EOS(STATIC_2859(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2859_0_addBefore_Load(EOS(STATIC_2859(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2860_0_addBefore_Load(EOS(STATIC_2860(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2860_0_addBefore_Load(EOS(STATIC_2860(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2861_0_addBefore_Load(EOS(STATIC_2861(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2861_0_addBefore_Load(EOS(STATIC_2861(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2862_0_addBefore_FieldAccess(EOS(STATIC_2862(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2862_0_addBefore_FieldAccess(EOS(STATIC_2862(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2863_0_addBefore_FieldAccess(EOS(STATIC_2863(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: o496[LinkedList$Entry.previous]o496 > 0 && o496[LinkedList$Entry.previous]o494 > 0 10.60/3.81 f2863_0_addBefore_FieldAccess(EOS(STATIC_2863(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2865_0_addBefore_FieldAccess(EOS(STATIC_2865(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: o495[LinkedList$Entry.next]o495 > 0 && o495[LinkedList$Entry.next]o494 > 0 10.60/3.81 f2865_0_addBefore_FieldAccess(EOS(STATIC_2865(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2867_0_addBefore_InvokeMethod(EOS(STATIC_2867(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2867_0_addBefore_InvokeMethod(EOS(STATIC_2867(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2868_0__init__Load(EOS(STATIC_2868(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2868_0__init__Load(EOS(STATIC_2868(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2869_0__init__InvokeMethod(EOS(STATIC_2869(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2869_0__init__InvokeMethod(EOS(STATIC_2869(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2870_0__init__Load(EOS(STATIC_2870(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2870_0__init__Load(EOS(STATIC_2870(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2871_0__init__Load(EOS(STATIC_2871(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2871_0__init__Load(EOS(STATIC_2871(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2872_0__init__FieldAccess(EOS(STATIC_2872(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2872_0__init__FieldAccess(EOS(STATIC_2872(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2873_0__init__Load(EOS(STATIC_2873(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2873_0__init__Load(EOS(STATIC_2873(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2874_0__init__Load(EOS(STATIC_2874(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2874_0__init__Load(EOS(STATIC_2874(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2875_0__init__FieldAccess(EOS(STATIC_2875(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2875_0__init__FieldAccess(EOS(STATIC_2875(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2876_0__init__Load(EOS(STATIC_2876(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2876_0__init__Load(EOS(STATIC_2876(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2877_0__init__Load(EOS(STATIC_2877(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2877_0__init__Load(EOS(STATIC_2877(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2878_0__init__FieldAccess(EOS(STATIC_2878(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2878_0__init__FieldAccess(EOS(STATIC_2878(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2879_0__init__Return(EOS(STATIC_2879(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2879_0__init__Return(EOS(STATIC_2879(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2880_0_addBefore_Store(EOS(STATIC_2880(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2880_0_addBefore_Store(EOS(STATIC_2880(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2881_0_addBefore_Load(EOS(STATIC_2881(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2881_0_addBefore_Load(EOS(STATIC_2881(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2882_0_addBefore_FieldAccess(EOS(STATIC_2882(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2882_0_addBefore_FieldAccess(EOS(STATIC_2882(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2883_0_addBefore_Load(EOS(STATIC_2883(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2883_0_addBefore_Load(EOS(STATIC_2883(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2884_0_addBefore_FieldAccess(EOS(STATIC_2884(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2884_0_addBefore_FieldAccess(EOS(STATIC_2884(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2885_0_addBefore_FieldAccess(EOS(STATIC_2885(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2885_0_addBefore_FieldAccess(EOS(STATIC_2885(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2887_0_addBefore_Load(EOS(STATIC_2887(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2887_0_addBefore_Load(EOS(STATIC_2887(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2888_0_addBefore_FieldAccess(EOS(STATIC_2888(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2888_0_addBefore_FieldAccess(EOS(STATIC_2888(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2889_0_addBefore_Load(EOS(STATIC_2889(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2889_0_addBefore_Load(EOS(STATIC_2889(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2890_0_addBefore_FieldAccess(EOS(STATIC_2890(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2890_0_addBefore_FieldAccess(EOS(STATIC_2890(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2891_0_addBefore_Load(EOS(STATIC_2891(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2891_0_addBefore_Load(EOS(STATIC_2891(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2892_0_addBefore_Duplicate(EOS(STATIC_2892(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2892_0_addBefore_Duplicate(EOS(STATIC_2892(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2893_0_addBefore_FieldAccess(EOS(STATIC_2893(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2893_0_addBefore_FieldAccess(EOS(STATIC_2893(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2894_0_addBefore_ConstantStackPush(EOS(STATIC_2894(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2894_0_addBefore_ConstantStackPush(EOS(STATIC_2894(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2895_0_addBefore_IntArithmetic(EOS(STATIC_2895(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2895_0_addBefore_IntArithmetic(EOS(STATIC_2895(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2896_0_addBefore_FieldAccess(EOS(STATIC_2896(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2896_0_addBefore_FieldAccess(EOS(STATIC_2896(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2897_0_addBefore_Load(EOS(STATIC_2897(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2897_0_addBefore_Load(EOS(STATIC_2897(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2898_0_addBefore_Duplicate(EOS(STATIC_2898(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2898_0_addBefore_Duplicate(EOS(STATIC_2898(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2899_0_addBefore_FieldAccess(EOS(STATIC_2899(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2899_0_addBefore_FieldAccess(EOS(STATIC_2899(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2900_0_addBefore_ConstantStackPush(EOS(STATIC_2900(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2900_0_addBefore_ConstantStackPush(EOS(STATIC_2900(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2901_0_addBefore_IntArithmetic(EOS(STATIC_2901(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2901_0_addBefore_IntArithmetic(EOS(STATIC_2901(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2902_0_addBefore_FieldAccess(EOS(STATIC_2902(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2902_0_addBefore_FieldAccess(EOS(STATIC_2902(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2903_0_addBefore_Load(EOS(STATIC_2903(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2903_0_addBefore_Load(EOS(STATIC_2903(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2904_0_addBefore_Return(EOS(STATIC_2904(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2904_0_addBefore_Return(EOS(STATIC_2904(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2905_0_addFirst_StackPop(EOS(STATIC_2905(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2905_0_addFirst_StackPop(EOS(STATIC_2905(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2906_0_addFirst_Return(EOS(STATIC_2906(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2906_0_addFirst_Return(EOS(STATIC_2906(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2907_0_createList_Inc(EOS(STATIC_2907(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2907_0_createList_Inc(EOS(STATIC_2907(java.lang.Object(ARRAY(i377)), i380)), i355, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2908_0_createList_JMP(EOS(STATIC_2908(java.lang.Object(ARRAY(i377)), i380)), i355 + -1, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2908_0_createList_JMP(EOS(STATIC_2908(java.lang.Object(ARRAY(i377)), i380)), i440, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2909_0_createList_Load(EOS(STATIC_2909(java.lang.Object(ARRAY(i377)), i380)), i440, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 f2909_0_createList_Load(EOS(STATIC_2909(java.lang.Object(ARRAY(i377)), i380)), i440, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2582_0_createList_Load(EOS(STATIC_2582(java.lang.Object(ARRAY(i377)), i380)), i440, o496[LinkedList$Entry.previous]o494, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o496, o494[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o575, o494[LinkedList$Entry.next]o575) :|: TRUE 10.60/3.81 f2582_0_createList_Load(EOS(STATIC_2582(java.lang.Object(o490sub), i345)), i347, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) -> f2583_0_createList_LE(EOS(STATIC_2583(java.lang.Object(o490sub), i345)), i347, i347, o496[LinkedList$Entry.previous]o495, o496[LinkedList$Entry.previous]o496, o496[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.next]o495, o495[LinkedList$Entry.next]o496, o495[LinkedList$Entry.next]o493, o496[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.next]o494) :|: TRUE 10.60/3.81 Combined rules. Obtained 1 IRulesP rules: 10.60/3.81 f2583_0_createList_LE(EOS(STATIC_2583(java.lang.Object(ARRAY(i377:0)), i345:0)), i355:0, i355:0, o496[LinkedList$Entry.previous]o495:0, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o495[LinkedList$Entry.next]o495:0, o495[LinkedList$Entry.next]o496:0, o495[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o494:0, o495[LinkedList$Entry.next]o494:0) -> f2583_0_createList_LE(EOS(STATIC_2583(java.lang.Object(ARRAY(i377:0)), i345:0 + 1)), i355:0 - 1, i355:0 - 1, o496[LinkedList$Entry.previous]o494:0, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o496:0, o494[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o575:0, o494[LinkedList$Entry.next]o575:0) :|: i355:0 > 0 && i377:0 > -1 && i377:0 > i345:0 && i345:0 > -1 && o496[LinkedList$Entry.previous]o493:0 > 0 && o496[LinkedList$Entry.previous]o496:0 > 0 && o495[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.next]o495:0 > 0 && o496[LinkedList$Entry.previous]o494:0 > 0 && o495[LinkedList$Entry.next]o494:0 > 0 10.60/3.81 Filtered duplicate arguments: 10.60/3.81 f2583_0_createList_LE(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) -> f2583_0_createList_LE(x1, x3, x4, x5, x6, x7, x8, x9, x10, x11) 10.60/3.81 Filtered unneeded arguments: 10.60/3.81 f2583_0_createList_LE(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) -> f2583_0_createList_LE(x1, x2, x4, x5, x6, x8, x9, x10) 10.60/3.81 Finished conversion. Obtained 1 rules.P rules: 10.60/3.81 f2583_0_createList_LE(i355:0, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o495[LinkedList$Entry.next]o495:0, o495[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o494:0, o495[LinkedList$Entry.next]o494:0, i377:0, i345:0) -> f2583_0_createList_LE(i355:0 - 1, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o575:0, o494[LinkedList$Entry.next]o575:0, i377:0, i345:0 + 1) :|: i377:0 > -1 && i355:0 > 0 && i377:0 > i345:0 && i345:0 > -1 && o496[LinkedList$Entry.previous]o493:0 > 0 && o496[LinkedList$Entry.previous]o496:0 > 0 && o495[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.next]o495:0 > 0 && o495[LinkedList$Entry.next]o494:0 > 0 && o496[LinkedList$Entry.previous]o494:0 > 0 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (8) 10.60/3.81 Obligation: 10.60/3.81 Rules: 10.60/3.81 f2583_0_createList_LE(i355:0, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o495[LinkedList$Entry.next]o495:0, o495[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o494:0, o495[LinkedList$Entry.next]o494:0, i377:0, i345:0) -> f2583_0_createList_LE(i355:0 - 1, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o575:0, o494[LinkedList$Entry.next]o575:0, i377:0, i345:0 + 1) :|: i377:0 > -1 && i355:0 > 0 && i377:0 > i345:0 && i345:0 > -1 && o496[LinkedList$Entry.previous]o493:0 > 0 && o496[LinkedList$Entry.previous]o496:0 > 0 && o495[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.next]o495:0 > 0 && o495[LinkedList$Entry.next]o494:0 > 0 && o496[LinkedList$Entry.previous]o494:0 > 0 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (9) IRSFormatTransformerProof (EQUIVALENT) 10.60/3.81 Reformatted IRS to match normalized format (transformed away non-linear left-hand sides, !=, / and %). 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (10) 10.60/3.81 Obligation: 10.60/3.81 Rules: 10.60/3.81 f2583_0_createList_LE(i355:0, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o495[LinkedList$Entry.next]o495:0, o495[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o494:0, o495[LinkedList$Entry.next]o494:0, i377:0, i345:0) -> f2583_0_createList_LE(arith, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o575:0, o494[LinkedList$Entry.next]o575:0, i377:0, arith1) :|: i377:0 > -1 && i355:0 > 0 && i377:0 > i345:0 && i345:0 > -1 && o496[LinkedList$Entry.previous]o493:0 > 0 && o496[LinkedList$Entry.previous]o496:0 > 0 && o495[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.next]o495:0 > 0 && o495[LinkedList$Entry.next]o494:0 > 0 && o496[LinkedList$Entry.previous]o494:0 > 0 && arith = i355:0 - 1 && arith1 = i345:0 + 1 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (11) IRSwTTerminationDigraphProof (EQUIVALENT) 10.60/3.81 Constructed termination digraph! 10.60/3.81 Nodes: 10.60/3.81 (1) f2583_0_createList_LE(i355:0, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o495[LinkedList$Entry.next]o495:0, o495[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o494:0, o495[LinkedList$Entry.next]o494:0, i377:0, i345:0) -> f2583_0_createList_LE(arith, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o575:0, o494[LinkedList$Entry.next]o575:0, i377:0, arith1) :|: i377:0 > -1 && i355:0 > 0 && i377:0 > i345:0 && i345:0 > -1 && o496[LinkedList$Entry.previous]o493:0 > 0 && o496[LinkedList$Entry.previous]o496:0 > 0 && o495[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.next]o495:0 > 0 && o495[LinkedList$Entry.next]o494:0 > 0 && o496[LinkedList$Entry.previous]o494:0 > 0 && arith = i355:0 - 1 && arith1 = i345:0 + 1 10.60/3.81 10.60/3.81 Arcs: 10.60/3.81 (1) -> (1) 10.60/3.81 10.60/3.81 This digraph is fully evaluated! 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (12) 10.60/3.81 Obligation: 10.60/3.81 10.60/3.81 Termination digraph: 10.60/3.81 Nodes: 10.60/3.81 (1) f2583_0_createList_LE(i355:0, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o495[LinkedList$Entry.next]o495:0, o495[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o494:0, o495[LinkedList$Entry.next]o494:0, i377:0, i345:0) -> f2583_0_createList_LE(arith, o496[LinkedList$Entry.previous]o496:0, o496[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o493:0, o496[LinkedList$Entry.previous]o575:0, o494[LinkedList$Entry.next]o575:0, i377:0, arith1) :|: i377:0 > -1 && i355:0 > 0 && i377:0 > i345:0 && i345:0 > -1 && o496[LinkedList$Entry.previous]o493:0 > 0 && o496[LinkedList$Entry.previous]o496:0 > 0 && o495[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.next]o495:0 > 0 && o495[LinkedList$Entry.next]o494:0 > 0 && o496[LinkedList$Entry.previous]o494:0 > 0 && arith = i355:0 - 1 && arith1 = i345:0 + 1 10.60/3.81 10.60/3.81 Arcs: 10.60/3.81 (1) -> (1) 10.60/3.81 10.60/3.81 This digraph is fully evaluated! 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (13) IntTRSCompressionProof (EQUIVALENT) 10.60/3.81 Compressed rules. 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (14) 10.60/3.81 Obligation: 10.60/3.81 Rules: 10.60/3.81 f2583_0_createList_LE(i355:0:0, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o495[LinkedList$Entry.next]o495:0:0, o495[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o494:0:0, o495[LinkedList$Entry.next]o494:0:0, i377:0:0, i345:0:0) -> f2583_0_createList_LE(i355:0:0 - 1, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o575:0:0, o494[LinkedList$Entry.next]o575:0:0, i377:0:0, i345:0:0 + 1) :|: o495[LinkedList$Entry.next]o494:0:0 > 0 && o496[LinkedList$Entry.previous]o494:0:0 > 0 && o495[LinkedList$Entry.next]o495:0:0 > 0 && o495[LinkedList$Entry.next]o493:0:0 > 0 && o496[LinkedList$Entry.previous]o496:0:0 > 0 && o496[LinkedList$Entry.previous]o493:0:0 > 0 && i345:0:0 > -1 && i377:0:0 > i345:0:0 && i355:0:0 > 0 && i377:0:0 > -1 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (15) TempFilterProof (SOUND) 10.60/3.81 Used the following sort dictionary for filtering: 10.60/3.81 f2583_0_createList_LE(INTEGER, INTEGER, INTEGER, VARIABLE, VARIABLE, VARIABLE, VARIABLE, INTEGER, INTEGER) 10.60/3.81 Replaced non-predefined constructor symbols by 0. 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (16) 10.60/3.81 Obligation: 10.60/3.81 Rules: 10.60/3.81 f2583_0_createList_LE(i355:0:0, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o495[LinkedList$Entry.next]o495:0:0, o495[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o494:0:0, o495[LinkedList$Entry.next]o494:0:0, i377:0:0, i345:0:0) -> f2583_0_createList_LE(c, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o575:0:0, o494[LinkedList$Entry.next]o575:0:0, i377:0:0, c1) :|: c1 = i345:0:0 + 1 && c = i355:0:0 - 1 && (o495[LinkedList$Entry.next]o494:0:0 > 0 && o496[LinkedList$Entry.previous]o494:0:0 > 0 && o495[LinkedList$Entry.next]o495:0:0 > 0 && o495[LinkedList$Entry.next]o493:0:0 > 0 && o496[LinkedList$Entry.previous]o496:0:0 > 0 && o496[LinkedList$Entry.previous]o493:0:0 > 0 && i345:0:0 > -1 && i377:0:0 > i345:0:0 && i355:0:0 > 0 && i377:0:0 > -1) 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (17) PolynomialOrderProcessor (EQUIVALENT) 10.60/3.81 Found the following polynomial interpretation: 10.60/3.81 [f2583_0_createList_LE(x, x1, x2, x3, x4, x5, x6, x7, x8)] = x 10.60/3.81 10.60/3.81 The following rules are decreasing: 10.60/3.81 f2583_0_createList_LE(i355:0:0, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o495[LinkedList$Entry.next]o495:0:0, o495[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o494:0:0, o495[LinkedList$Entry.next]o494:0:0, i377:0:0, i345:0:0) -> f2583_0_createList_LE(c, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o575:0:0, o494[LinkedList$Entry.next]o575:0:0, i377:0:0, c1) :|: c1 = i345:0:0 + 1 && c = i355:0:0 - 1 && (o495[LinkedList$Entry.next]o494:0:0 > 0 && o496[LinkedList$Entry.previous]o494:0:0 > 0 && o495[LinkedList$Entry.next]o495:0:0 > 0 && o495[LinkedList$Entry.next]o493:0:0 > 0 && o496[LinkedList$Entry.previous]o496:0:0 > 0 && o496[LinkedList$Entry.previous]o493:0:0 > 0 && i345:0:0 > -1 && i377:0:0 > i345:0:0 && i355:0:0 > 0 && i377:0:0 > -1) 10.60/3.81 The following rules are bounded: 10.60/3.81 f2583_0_createList_LE(i355:0:0, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o495[LinkedList$Entry.next]o495:0:0, o495[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o494:0:0, o495[LinkedList$Entry.next]o494:0:0, i377:0:0, i345:0:0) -> f2583_0_createList_LE(c, o496[LinkedList$Entry.previous]o496:0:0, o496[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o493:0:0, o496[LinkedList$Entry.previous]o575:0:0, o494[LinkedList$Entry.next]o575:0:0, i377:0:0, c1) :|: c1 = i345:0:0 + 1 && c = i355:0:0 - 1 && (o495[LinkedList$Entry.next]o494:0:0 > 0 && o496[LinkedList$Entry.previous]o494:0:0 > 0 && o495[LinkedList$Entry.next]o495:0:0 > 0 && o495[LinkedList$Entry.next]o493:0:0 > 0 && o496[LinkedList$Entry.previous]o496:0:0 > 0 && o496[LinkedList$Entry.previous]o493:0:0 > 0 && i345:0:0 > -1 && i377:0:0 > i345:0:0 && i355:0:0 > 0 && i377:0:0 > -1) 10.60/3.81 10.60/3.81 ---------------------------------------- 10.60/3.81 10.60/3.81 (18) 10.60/3.81 YES 10.88/3.93 EOF