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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The twelve methods described above are summarized in the 10.30/3.58 * following table: 10.30/3.58 * 10.30/3.58 *

10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 *
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.30/3.58 * 10.30/3.58 *

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

10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 *
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.30/3.58 * 10.30/3.58 *

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

10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 * 10.30/3.58 *
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.30/3.58 * 10.30/3.58 *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

10.30/3.58 * 10.30/3.58 *

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

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

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

10.30/3.58 * 10.30/3.58 *

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

10.30/3.58	 *   List list = Collections.synchronizedList(new LinkedList(...));
10.30/3.58 * 10.30/3.58 *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 * 10.30/3.59 *
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.30/3.59 * 10.30/3.59 *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The twelve methods described above are summarized in the 10.30/3.60 * following table: 10.30/3.60 * 10.30/3.60 *

10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 *
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.30/3.60 * 10.30/3.60 *

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

10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 *
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.30/3.60 * 10.30/3.60 *

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

10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 * 10.30/3.60 *
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.30/3.60 * 10.30/3.60 *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

10.30/3.60 * 10.30/3.60 *

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

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

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

10.30/3.60 * 10.30/3.60 *

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

10.30/3.60	 *   List list = Collections.synchronizedList(new LinkedList(...));
10.30/3.60 * 10.30/3.60 *

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 * 10.41/3.61 *
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.41/3.61 * 10.41/3.61 *

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

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

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

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

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

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

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

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

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

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

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

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

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

Note that the detail message associated with cause is 10.41/3.61 * not automatically incorporated in this exception's detail 10.41/3.61 * message. 10.41/3.61 * 10.41/3.61 * @param message the detail message (which is saved for later retrieval 10.41/3.61 * by the {@link Throwable#getMessage()} method). 10.41/3.61 * @param cause the cause (which is saved for later retrieval by the 10.41/3.61 * {@link Throwable#getCause()} method). (A null value 10.41/3.61 * is permitted, and indicates that the cause is nonexistent or 10.41/3.61 * unknown.) 10.41/3.61 * @since 1.5 10.41/3.61 */ 10.41/3.61 public UnsupportedOperationException(String message, Throwable cause) { 10.41/3.61 super(message, cause); 10.41/3.61 } 10.41/3.61 10.41/3.61 /** 10.41/3.61 * Constructs a new exception with the specified cause and a detail 10.41/3.61 * message of (cause==null ? null : cause.toString()) (which 10.41/3.61 * typically contains the class and detail message of cause). 10.41/3.61 * This constructor is useful for exceptions that are little more than 10.41/3.61 * wrappers for other throwables (for example, {@link 10.41/3.61 * java.security.PrivilegedActionException}). 10.41/3.61 * 10.41/3.61 * @param cause the cause (which is saved for later retrieval by the 10.41/3.61 * {@link Throwable#getCause()} method). (A null value is 10.41/3.61 * permitted, and indicates that the cause is nonexistent or 10.41/3.61 * unknown.) 10.41/3.61 * @since 1.5 10.41/3.61 */ 10.41/3.61 public UnsupportedOperationException(Throwable cause) { 10.41/3.61 super(cause); 10.41/3.61 } 10.41/3.61 10.41/3.61 static final long serialVersionUID = -1242599979055084673L; 10.41/3.61 } 10.41/3.61 10.41/3.61 10.41/3.61 10.41/3.61 ---------------------------------------- 10.41/3.61 10.41/3.61 (3) JBCToGraph (EQUIVALENT) 10.41/3.61 Constructed TerminationGraph. 10.41/3.61 ---------------------------------------- 10.41/3.61 10.41/3.61 (4) 10.41/3.61 Obligation: 10.41/3.61 Termination Graph based on JBC Program: 10.41/3.61 javaUtilEx.juLinkedListCreateSize.main([Ljava/lang/String;)V: Graph of 118 nodes with 0 SCCs. 10.41/3.61 10.41/3.61 10.41/3.61 10.41/3.61 javaUtilEx.juLinkedListCreateSize.createList(I)LjavaUtilEx/LinkedList;: Graph of 223 nodes with 1 SCC. 10.41/3.61 10.41/3.61 10.41/3.61 10.41/3.61 10.41/3.61 10.41/3.61 ---------------------------------------- 10.41/3.61 10.41/3.61 (5) TerminationGraphToSCCProof (SOUND) 10.41/3.61 Splitted TerminationGraph to 1 SCCs. 10.41/3.61 ---------------------------------------- 10.41/3.61 10.41/3.61 (6) 10.41/3.61 Obligation: 10.41/3.61 SCC of termination graph based on JBC Program. 10.41/3.61 SCC contains nodes from the following methods: javaUtilEx.juLinkedListCreateSize.createList(I)LjavaUtilEx/LinkedList; 10.41/3.61 SCC calls the following helper methods: 10.41/3.61 Performed SCC analyses: 10.41/3.61 *Used field analysis yielded the following read fields: 10.41/3.61 *java.lang.String: [count] 10.41/3.61 *javaUtilEx.LinkedList: [header, size] 10.41/3.61 *javaUtilEx.LinkedList$Entry: [next, previous] 10.41/3.61 *javaUtilEx.AbstractList: [modCount] 10.41/3.61 *Marker field analysis yielded the following relations that could be markers: 10.41/3.61 10.41/3.61 ---------------------------------------- 10.41/3.61 10.41/3.61 (7) SCCToIRSProof (SOUND) 10.41/3.61 Transformed FIGraph SCCs to intTRSs. Log: 10.41/3.61 Generated rules. Obtained 93 IRulesP rules: 10.41/3.61 f2675_0_createList_LE(EOS(STATIC_2675(java.lang.Object(o489sub), i345)), i355, i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2677_0_createList_LE(EOS(STATIC_2677(java.lang.Object(o489sub), i345)), i355, i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2677_0_createList_LE(EOS(STATIC_2677(java.lang.Object(o489sub), i345)), i355, i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2679_0_createList_Load(EOS(STATIC_2679(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: i355 > 0 10.41/3.61 f2679_0_createList_Load(EOS(STATIC_2679(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2681_0_createList_New(EOS(STATIC_2681(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2681_0_createList_New(EOS(STATIC_2681(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2683_0_createList_Duplicate(EOS(STATIC_2683(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2683_0_createList_Duplicate(EOS(STATIC_2683(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2684_0_createList_InvokeMethod(EOS(STATIC_2684(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2684_0_createList_InvokeMethod(EOS(STATIC_2684(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2687_0_random_FieldAccess(EOS(STATIC_2687(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2687_0_random_FieldAccess(EOS(STATIC_2687(java.lang.Object(o489sub), i345)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2690_0_random_FieldAccess(EOS(STATIC_2690(java.lang.Object(o489sub), i345)), i355, java.lang.Object(o489sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2690_0_random_FieldAccess(EOS(STATIC_2690(java.lang.Object(o489sub), i345)), i355, java.lang.Object(o489sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2693_0_random_ArrayAccess(EOS(STATIC_2693(java.lang.Object(o489sub), i345)), i355, java.lang.Object(o489sub), i345, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2693_0_random_ArrayAccess(EOS(STATIC_2693(java.lang.Object(ARRAY(i369)), i345)), i355, java.lang.Object(ARRAY(i369)), i345, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2698_0_random_ArrayAccess(EOS(STATIC_2698(java.lang.Object(ARRAY(i369)), i345)), i355, java.lang.Object(ARRAY(i369)), i345, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: i369 >= 0 10.41/3.61 f2698_0_random_ArrayAccess(EOS(STATIC_2698(java.lang.Object(ARRAY(i369)), i371)), i355, java.lang.Object(ARRAY(i369)), i371, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2700_0_random_ArrayAccess(EOS(STATIC_2700(java.lang.Object(ARRAY(i369)), i371)), i355, java.lang.Object(ARRAY(i369)), i371, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2700_0_random_ArrayAccess(EOS(STATIC_2700(java.lang.Object(ARRAY(i369)), i371)), i355, java.lang.Object(ARRAY(i369)), i371, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2703_0_random_ArrayAccess(EOS(STATIC_2703(java.lang.Object(ARRAY(i369)), i371)), i355, java.lang.Object(ARRAY(i369)), i371, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2703_0_random_ArrayAccess(EOS(STATIC_2703(java.lang.Object(ARRAY(i369)), i371)), i355, java.lang.Object(ARRAY(i369)), i371, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2706_0_random_Store(EOS(STATIC_2706(java.lang.Object(ARRAY(i369)), i371)), i355, o518, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: i371 < i369 10.41/3.61 f2706_0_random_Store(EOS(STATIC_2706(java.lang.Object(ARRAY(i369)), i371)), i355, o518, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2710_0_random_FieldAccess(EOS(STATIC_2710(java.lang.Object(ARRAY(i369)), i371)), i355, o518, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2710_0_random_FieldAccess(EOS(STATIC_2710(java.lang.Object(ARRAY(i369)), i371)), i355, o518, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2713_0_random_ConstantStackPush(EOS(STATIC_2713(java.lang.Object(ARRAY(i369)), i371)), i355, o518, i371, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2713_0_random_ConstantStackPush(EOS(STATIC_2713(java.lang.Object(ARRAY(i369)), i371)), i355, o518, i371, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2716_0_random_IntArithmetic(EOS(STATIC_2716(java.lang.Object(ARRAY(i369)), i371)), i355, o518, i371, 1, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2716_0_random_IntArithmetic(EOS(STATIC_2716(java.lang.Object(ARRAY(i369)), i371)), i355, o518, i371, matching1, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2719_0_random_FieldAccess(EOS(STATIC_2719(java.lang.Object(ARRAY(i369)), i371)), i355, o518, i371 + 1, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: i371 >= 0 && matching1 = 1 10.41/3.61 f2719_0_random_FieldAccess(EOS(STATIC_2719(java.lang.Object(ARRAY(i369)), i371)), i355, o518, i372, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2721_0_random_Load(EOS(STATIC_2721(java.lang.Object(ARRAY(i369)), i372)), i355, o518, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2721_0_random_Load(EOS(STATIC_2721(java.lang.Object(ARRAY(i369)), i372)), i355, o518, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2723_0_random_InvokeMethod(EOS(STATIC_2723(java.lang.Object(ARRAY(i369)), i372)), i355, o518, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2723_0_random_InvokeMethod(EOS(STATIC_2723(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o520sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2726_0_random_InvokeMethod(EOS(STATIC_2726(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o520sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2726_0_random_InvokeMethod(EOS(STATIC_2726(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o521sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2729_0_random_InvokeMethod(EOS(STATIC_2729(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o521sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2729_0_random_InvokeMethod(EOS(STATIC_2729(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o521sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2732_0_length_Load(EOS(STATIC_2732(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o521sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2732_0_length_Load(EOS(STATIC_2732(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o521sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2737_0_length_FieldAccess(EOS(STATIC_2737(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(o521sub), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2737_0_length_FieldAccess(EOS(STATIC_2737(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(java.lang.String(EOC, i376)), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2740_0_length_FieldAccess(EOS(STATIC_2740(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(java.lang.String(EOC, i376)), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2740_0_length_FieldAccess(EOS(STATIC_2740(java.lang.Object(ARRAY(i369)), i372)), i355, java.lang.Object(java.lang.String(EOC, i376)), o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2743_0_length_Return(EOS(STATIC_2743(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2743_0_length_Return(EOS(STATIC_2743(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2746_0_random_Return(EOS(STATIC_2746(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2746_0_random_Return(EOS(STATIC_2746(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2750_0_createList_InvokeMethod(EOS(STATIC_2750(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2750_0_createList_InvokeMethod(EOS(STATIC_2750(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2753_0__init__Load(EOS(STATIC_2753(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2753_0__init__Load(EOS(STATIC_2753(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2760_0__init__InvokeMethod(EOS(STATIC_2760(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2760_0__init__InvokeMethod(EOS(STATIC_2760(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2766_0__init__Load(EOS(STATIC_2766(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2766_0__init__Load(EOS(STATIC_2766(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2773_0__init__Load(EOS(STATIC_2773(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2773_0__init__Load(EOS(STATIC_2773(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2782_0__init__FieldAccess(EOS(STATIC_2782(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2782_0__init__FieldAccess(EOS(STATIC_2782(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2790_0__init__Return(EOS(STATIC_2790(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2790_0__init__Return(EOS(STATIC_2790(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2799_0_createList_InvokeMethod(EOS(STATIC_2799(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2799_0_createList_InvokeMethod(EOS(STATIC_2799(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2813_0_addFirst_Load(EOS(STATIC_2813(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2813_0_addFirst_Load(EOS(STATIC_2813(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2837_0_addFirst_Load(EOS(STATIC_2837(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2837_0_addFirst_Load(EOS(STATIC_2837(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2846_0_addFirst_Load(EOS(STATIC_2846(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2846_0_addFirst_Load(EOS(STATIC_2846(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2882_0_addFirst_FieldAccess(EOS(STATIC_2882(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2882_0_addFirst_FieldAccess(EOS(STATIC_2882(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2935_0_addFirst_FieldAccess(EOS(STATIC_2935(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2935_0_addFirst_FieldAccess(EOS(STATIC_2935(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2938_0_addFirst_FieldAccess(EOS(STATIC_2938(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: o495[LinkedList$Entry.previous]o495 > 0 && o495[LinkedList$Entry.previous]o492 > 0 10.41/3.61 f2938_0_addFirst_FieldAccess(EOS(STATIC_2938(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2952_0_addFirst_FieldAccess(EOS(STATIC_2952(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: o494[LinkedList$Entry.next]o494 > 0 && o494[LinkedList$Entry.next]o492 > 0 10.41/3.61 f2952_0_addFirst_FieldAccess(EOS(STATIC_2952(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2955_0_addFirst_InvokeMethod(EOS(STATIC_2955(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2955_0_addFirst_InvokeMethod(EOS(STATIC_2955(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2957_0_addBefore_New(EOS(STATIC_2957(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2957_0_addBefore_New(EOS(STATIC_2957(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2959_0_addBefore_Duplicate(EOS(STATIC_2959(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2959_0_addBefore_Duplicate(EOS(STATIC_2959(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2960_0_addBefore_Load(EOS(STATIC_2960(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2960_0_addBefore_Load(EOS(STATIC_2960(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2961_0_addBefore_Load(EOS(STATIC_2961(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2961_0_addBefore_Load(EOS(STATIC_2961(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2962_0_addBefore_Load(EOS(STATIC_2962(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2962_0_addBefore_Load(EOS(STATIC_2962(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2963_0_addBefore_FieldAccess(EOS(STATIC_2963(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2963_0_addBefore_FieldAccess(EOS(STATIC_2963(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2964_0_addBefore_FieldAccess(EOS(STATIC_2964(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: o495[LinkedList$Entry.previous]o495 > 0 && o495[LinkedList$Entry.previous]o493 > 0 10.41/3.61 f2964_0_addBefore_FieldAccess(EOS(STATIC_2964(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2966_0_addBefore_FieldAccess(EOS(STATIC_2966(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: o494[LinkedList$Entry.next]o494 > 0 && o494[LinkedList$Entry.next]o493 > 0 10.41/3.61 f2966_0_addBefore_FieldAccess(EOS(STATIC_2966(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2968_0_addBefore_InvokeMethod(EOS(STATIC_2968(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2968_0_addBefore_InvokeMethod(EOS(STATIC_2968(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2969_0__init__Load(EOS(STATIC_2969(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2969_0__init__Load(EOS(STATIC_2969(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2970_0__init__InvokeMethod(EOS(STATIC_2970(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2970_0__init__InvokeMethod(EOS(STATIC_2970(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2971_0__init__Load(EOS(STATIC_2971(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2971_0__init__Load(EOS(STATIC_2971(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2972_0__init__Load(EOS(STATIC_2972(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2972_0__init__Load(EOS(STATIC_2972(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2973_0__init__FieldAccess(EOS(STATIC_2973(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2973_0__init__FieldAccess(EOS(STATIC_2973(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2974_0__init__Load(EOS(STATIC_2974(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2974_0__init__Load(EOS(STATIC_2974(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2975_0__init__Load(EOS(STATIC_2975(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2975_0__init__Load(EOS(STATIC_2975(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2976_0__init__FieldAccess(EOS(STATIC_2976(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2976_0__init__FieldAccess(EOS(STATIC_2976(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2977_0__init__Load(EOS(STATIC_2977(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2977_0__init__Load(EOS(STATIC_2977(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2978_0__init__Load(EOS(STATIC_2978(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2978_0__init__Load(EOS(STATIC_2978(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2979_0__init__FieldAccess(EOS(STATIC_2979(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2979_0__init__FieldAccess(EOS(STATIC_2979(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2980_0__init__Return(EOS(STATIC_2980(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2980_0__init__Return(EOS(STATIC_2980(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2981_0_addBefore_Store(EOS(STATIC_2981(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2981_0_addBefore_Store(EOS(STATIC_2981(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2982_0_addBefore_Load(EOS(STATIC_2982(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2982_0_addBefore_Load(EOS(STATIC_2982(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2983_0_addBefore_FieldAccess(EOS(STATIC_2983(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2983_0_addBefore_FieldAccess(EOS(STATIC_2983(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2984_0_addBefore_Load(EOS(STATIC_2984(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2984_0_addBefore_Load(EOS(STATIC_2984(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2985_0_addBefore_FieldAccess(EOS(STATIC_2985(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.61 f2985_0_addBefore_FieldAccess(EOS(STATIC_2985(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2989_0_addBefore_FieldAccess(EOS(STATIC_2989(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2989_0_addBefore_FieldAccess(EOS(STATIC_2989(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2992_0_addBefore_Load(EOS(STATIC_2992(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2992_0_addBefore_Load(EOS(STATIC_2992(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2993_0_addBefore_FieldAccess(EOS(STATIC_2993(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2993_0_addBefore_FieldAccess(EOS(STATIC_2993(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2994_0_addBefore_Load(EOS(STATIC_2994(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2994_0_addBefore_Load(EOS(STATIC_2994(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2995_0_addBefore_FieldAccess(EOS(STATIC_2995(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2995_0_addBefore_FieldAccess(EOS(STATIC_2995(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2996_0_addBefore_Load(EOS(STATIC_2996(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2996_0_addBefore_Load(EOS(STATIC_2996(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2997_0_addBefore_Duplicate(EOS(STATIC_2997(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2997_0_addBefore_Duplicate(EOS(STATIC_2997(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2998_0_addBefore_FieldAccess(EOS(STATIC_2998(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2998_0_addBefore_FieldAccess(EOS(STATIC_2998(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2999_0_addBefore_ConstantStackPush(EOS(STATIC_2999(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f2999_0_addBefore_ConstantStackPush(EOS(STATIC_2999(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3000_0_addBefore_IntArithmetic(EOS(STATIC_3000(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3000_0_addBefore_IntArithmetic(EOS(STATIC_3000(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3001_0_addBefore_FieldAccess(EOS(STATIC_3001(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3001_0_addBefore_FieldAccess(EOS(STATIC_3001(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3002_0_addBefore_Load(EOS(STATIC_3002(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3002_0_addBefore_Load(EOS(STATIC_3002(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3003_0_addBefore_Duplicate(EOS(STATIC_3003(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3003_0_addBefore_Duplicate(EOS(STATIC_3003(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3004_0_addBefore_FieldAccess(EOS(STATIC_3004(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3004_0_addBefore_FieldAccess(EOS(STATIC_3004(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3005_0_addBefore_ConstantStackPush(EOS(STATIC_3005(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3005_0_addBefore_ConstantStackPush(EOS(STATIC_3005(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3006_0_addBefore_IntArithmetic(EOS(STATIC_3006(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3006_0_addBefore_IntArithmetic(EOS(STATIC_3006(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3007_0_addBefore_FieldAccess(EOS(STATIC_3007(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3007_0_addBefore_FieldAccess(EOS(STATIC_3007(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3008_0_addBefore_Load(EOS(STATIC_3008(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3008_0_addBefore_Load(EOS(STATIC_3008(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3009_0_addBefore_Return(EOS(STATIC_3009(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3009_0_addBefore_Return(EOS(STATIC_3009(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3010_0_addFirst_StackPop(EOS(STATIC_3010(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3010_0_addFirst_StackPop(EOS(STATIC_3010(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3011_0_addFirst_Return(EOS(STATIC_3011(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3011_0_addFirst_Return(EOS(STATIC_3011(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3013_0_createList_Inc(EOS(STATIC_3013(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3013_0_createList_Inc(EOS(STATIC_3013(java.lang.Object(ARRAY(i369)), i372)), i355, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3014_0_createList_JMP(EOS(STATIC_3014(java.lang.Object(ARRAY(i369)), i372)), i355 + -1, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3014_0_createList_JMP(EOS(STATIC_3014(java.lang.Object(ARRAY(i369)), i372)), i440, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f3040_0_createList_Load(EOS(STATIC_3040(java.lang.Object(ARRAY(i369)), i372)), i440, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 f3040_0_createList_Load(EOS(STATIC_3040(java.lang.Object(ARRAY(i369)), i372)), i440, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2673_0_createList_Load(EOS(STATIC_2673(java.lang.Object(ARRAY(i369)), i372)), i440, o495[LinkedList$Entry.previous]o493, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o493[LinkedList$Entry.next]o493, o493[LinkedList$Entry.next]o495, o493[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o575, o493[LinkedList$Entry.next]o575) :|: TRUE 10.41/3.62 f2673_0_createList_Load(EOS(STATIC_2673(java.lang.Object(o489sub), i345)), i347, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) -> f2675_0_createList_LE(EOS(STATIC_2675(java.lang.Object(o489sub), i345)), i347, i347, o495[LinkedList$Entry.previous]o494, o495[LinkedList$Entry.previous]o495, o495[LinkedList$Entry.previous]o492, o494[LinkedList$Entry.next]o494, o494[LinkedList$Entry.next]o495, o494[LinkedList$Entry.next]o492, o495[LinkedList$Entry.previous]o493, o494[LinkedList$Entry.next]o493) :|: TRUE 10.41/3.62 Combined rules. Obtained 1 IRulesP rules: 10.41/3.62 f2675_0_createList_LE(EOS(STATIC_2675(java.lang.Object(ARRAY(i369:0)), i345:0)), i355:0, i355:0, o495[LinkedList$Entry.previous]o494:0, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o495:0, o494[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o493:0) -> f2675_0_createList_LE(EOS(STATIC_2675(java.lang.Object(ARRAY(i369:0)), i345:0 + 1)), i355:0 - 1, i355:0 - 1, o495[LinkedList$Entry.previous]o493:0, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o493[LinkedList$Entry.next]o493:0, o493[LinkedList$Entry.next]o495:0, o493[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o575:0, o493[LinkedList$Entry.next]o575:0) :|: i355:0 > 0 && i369:0 > -1 && i369:0 > i345:0 && i345:0 > -1 && o495[LinkedList$Entry.previous]o492:0 > 0 && o495[LinkedList$Entry.previous]o495:0 > 0 && o494[LinkedList$Entry.next]o492:0 > 0 && o494[LinkedList$Entry.next]o494:0 > 0 && o495[LinkedList$Entry.previous]o493:0 > 0 && o494[LinkedList$Entry.next]o493:0 > 0 10.41/3.62 Filtered duplicate arguments: 10.41/3.62 f2675_0_createList_LE(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11) -> f2675_0_createList_LE(x1, x3, x4, x5, x6, x7, x8, x9, x10, x11) 10.41/3.62 Filtered unneeded arguments: 10.41/3.62 f2675_0_createList_LE(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) -> f2675_0_createList_LE(x1, x2, x4, x5, x6, x8, x9, x10) 10.41/3.62 Finished conversion. Obtained 1 rules.P rules: 10.41/3.62 f2675_0_createList_LE(i355:0, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o493:0, i369:0, i345:0) -> f2675_0_createList_LE(i355:0 - 1, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o493[LinkedList$Entry.next]o493:0, o493[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o575:0, o493[LinkedList$Entry.next]o575:0, i369:0, i345:0 + 1) :|: i369:0 > -1 && i355:0 > 0 && i369:0 > i345:0 && i345:0 > -1 && o495[LinkedList$Entry.previous]o492:0 > 0 && o495[LinkedList$Entry.previous]o495:0 > 0 && o494[LinkedList$Entry.next]o492:0 > 0 && o494[LinkedList$Entry.next]o494:0 > 0 && o494[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.previous]o493:0 > 0 10.41/3.62 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (8) 10.41/3.62 Obligation: 10.41/3.62 Rules: 10.41/3.62 f2675_0_createList_LE(i355:0, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o493:0, i369:0, i345:0) -> f2675_0_createList_LE(i355:0 - 1, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o493[LinkedList$Entry.next]o493:0, o493[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o575:0, o493[LinkedList$Entry.next]o575:0, i369:0, i345:0 + 1) :|: i369:0 > -1 && i355:0 > 0 && i369:0 > i345:0 && i345:0 > -1 && o495[LinkedList$Entry.previous]o492:0 > 0 && o495[LinkedList$Entry.previous]o495:0 > 0 && o494[LinkedList$Entry.next]o492:0 > 0 && o494[LinkedList$Entry.next]o494:0 > 0 && o494[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.previous]o493:0 > 0 10.41/3.62 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (9) IRSFormatTransformerProof (EQUIVALENT) 10.41/3.62 Reformatted IRS to match normalized format (transformed away non-linear left-hand sides, !=, / and %). 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (10) 10.41/3.62 Obligation: 10.41/3.62 Rules: 10.41/3.62 f2675_0_createList_LE(i355:0, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o493:0, i369:0, i345:0) -> f2675_0_createList_LE(arith, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o493[LinkedList$Entry.next]o493:0, o493[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o575:0, o493[LinkedList$Entry.next]o575:0, i369:0, arith1) :|: i369:0 > -1 && i355:0 > 0 && i369:0 > i345:0 && i345:0 > -1 && o495[LinkedList$Entry.previous]o492:0 > 0 && o495[LinkedList$Entry.previous]o495:0 > 0 && o494[LinkedList$Entry.next]o492:0 > 0 && o494[LinkedList$Entry.next]o494:0 > 0 && o494[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.previous]o493:0 > 0 && arith = i355:0 - 1 && arith1 = i345:0 + 1 10.41/3.62 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (11) IRSwTTerminationDigraphProof (EQUIVALENT) 10.41/3.62 Constructed termination digraph! 10.41/3.62 Nodes: 10.41/3.62 (1) f2675_0_createList_LE(i355:0, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o493:0, i369:0, i345:0) -> f2675_0_createList_LE(arith, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o493[LinkedList$Entry.next]o493:0, o493[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o575:0, o493[LinkedList$Entry.next]o575:0, i369:0, arith1) :|: i369:0 > -1 && i355:0 > 0 && i369:0 > i345:0 && i345:0 > -1 && o495[LinkedList$Entry.previous]o492:0 > 0 && o495[LinkedList$Entry.previous]o495:0 > 0 && o494[LinkedList$Entry.next]o492:0 > 0 && o494[LinkedList$Entry.next]o494:0 > 0 && o494[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.previous]o493:0 > 0 && arith = i355:0 - 1 && arith1 = i345:0 + 1 10.41/3.62 10.41/3.62 Arcs: 10.41/3.62 (1) -> (1) 10.41/3.62 10.41/3.62 This digraph is fully evaluated! 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (12) 10.41/3.62 Obligation: 10.41/3.62 10.41/3.62 Termination digraph: 10.41/3.62 Nodes: 10.41/3.62 (1) f2675_0_createList_LE(i355:0, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o494[LinkedList$Entry.next]o494:0, o494[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o493:0, o494[LinkedList$Entry.next]o493:0, i369:0, i345:0) -> f2675_0_createList_LE(arith, o495[LinkedList$Entry.previous]o495:0, o495[LinkedList$Entry.previous]o492:0, o493[LinkedList$Entry.next]o493:0, o493[LinkedList$Entry.next]o492:0, o495[LinkedList$Entry.previous]o575:0, o493[LinkedList$Entry.next]o575:0, i369:0, arith1) :|: i369:0 > -1 && i355:0 > 0 && i369:0 > i345:0 && i345:0 > -1 && o495[LinkedList$Entry.previous]o492:0 > 0 && o495[LinkedList$Entry.previous]o495:0 > 0 && o494[LinkedList$Entry.next]o492:0 > 0 && o494[LinkedList$Entry.next]o494:0 > 0 && o494[LinkedList$Entry.next]o493:0 > 0 && o495[LinkedList$Entry.previous]o493:0 > 0 && arith = i355:0 - 1 && arith1 = i345:0 + 1 10.41/3.62 10.41/3.62 Arcs: 10.41/3.62 (1) -> (1) 10.41/3.62 10.41/3.62 This digraph is fully evaluated! 10.41/3.62 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (13) IntTRSCompressionProof (EQUIVALENT) 10.41/3.62 Compressed rules. 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (14) 10.41/3.62 Obligation: 10.41/3.62 Rules: 10.41/3.62 f2675_0_createList_LE(i355:0:0, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o493:0:0, i369:0:0, i345:0:0) -> f2675_0_createList_LE(i355:0:0 - 1, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o493[LinkedList$Entry.next]o493:0:0, o493[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o575:0:0, o493[LinkedList$Entry.next]o575:0:0, i369:0:0, i345:0:0 + 1) :|: o494[LinkedList$Entry.next]o493:0:0 > 0 && o495[LinkedList$Entry.previous]o493:0:0 > 0 && o494[LinkedList$Entry.next]o494:0:0 > 0 && o494[LinkedList$Entry.next]o492:0:0 > 0 && o495[LinkedList$Entry.previous]o495:0:0 > 0 && o495[LinkedList$Entry.previous]o492:0:0 > 0 && i345:0:0 > -1 && i369:0:0 > i345:0:0 && i355:0:0 > 0 && i369:0:0 > -1 10.41/3.62 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (15) TempFilterProof (SOUND) 10.41/3.62 Used the following sort dictionary for filtering: 10.41/3.62 f2675_0_createList_LE(INTEGER, INTEGER, INTEGER, VARIABLE, VARIABLE, VARIABLE, VARIABLE, INTEGER, INTEGER) 10.41/3.62 Replaced non-predefined constructor symbols by 0. 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (16) 10.41/3.62 Obligation: 10.41/3.62 Rules: 10.41/3.62 f2675_0_createList_LE(i355:0:0, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o493:0:0, i369:0:0, i345:0:0) -> f2675_0_createList_LE(c, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o493[LinkedList$Entry.next]o493:0:0, o493[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o575:0:0, o493[LinkedList$Entry.next]o575:0:0, i369:0:0, c1) :|: c1 = i345:0:0 + 1 && c = i355:0:0 - 1 && (o494[LinkedList$Entry.next]o493:0:0 > 0 && o495[LinkedList$Entry.previous]o493:0:0 > 0 && o494[LinkedList$Entry.next]o494:0:0 > 0 && o494[LinkedList$Entry.next]o492:0:0 > 0 && o495[LinkedList$Entry.previous]o495:0:0 > 0 && o495[LinkedList$Entry.previous]o492:0:0 > 0 && i345:0:0 > -1 && i369:0:0 > i345:0:0 && i355:0:0 > 0 && i369:0:0 > -1) 10.41/3.62 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (17) RankingReductionPairProof (EQUIVALENT) 10.41/3.62 Interpretation: 10.41/3.62 [ f2675_0_createList_LE ] = f2675_0_createList_LE_1 10.41/3.62 10.41/3.62 The following rules are decreasing: 10.41/3.62 f2675_0_createList_LE(i355:0:0, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o493:0:0, i369:0:0, i345:0:0) -> f2675_0_createList_LE(c, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o493[LinkedList$Entry.next]o493:0:0, o493[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o575:0:0, o493[LinkedList$Entry.next]o575:0:0, i369:0:0, c1) :|: c1 = i345:0:0 + 1 && c = i355:0:0 - 1 && (o494[LinkedList$Entry.next]o493:0:0 > 0 && o495[LinkedList$Entry.previous]o493:0:0 > 0 && o494[LinkedList$Entry.next]o494:0:0 > 0 && o494[LinkedList$Entry.next]o492:0:0 > 0 && o495[LinkedList$Entry.previous]o495:0:0 > 0 && o495[LinkedList$Entry.previous]o492:0:0 > 0 && i345:0:0 > -1 && i369:0:0 > i345:0:0 && i355:0:0 > 0 && i369:0:0 > -1) 10.41/3.62 10.41/3.62 The following rules are bounded: 10.41/3.62 f2675_0_createList_LE(i355:0:0, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o494[LinkedList$Entry.next]o494:0:0, o494[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o493:0:0, o494[LinkedList$Entry.next]o493:0:0, i369:0:0, i345:0:0) -> f2675_0_createList_LE(c, o495[LinkedList$Entry.previous]o495:0:0, o495[LinkedList$Entry.previous]o492:0:0, o493[LinkedList$Entry.next]o493:0:0, o493[LinkedList$Entry.next]o492:0:0, o495[LinkedList$Entry.previous]o575:0:0, o493[LinkedList$Entry.next]o575:0:0, i369:0:0, c1) :|: c1 = i345:0:0 + 1 && c = i355:0:0 - 1 && (o494[LinkedList$Entry.next]o493:0:0 > 0 && o495[LinkedList$Entry.previous]o493:0:0 > 0 && o494[LinkedList$Entry.next]o494:0:0 > 0 && o494[LinkedList$Entry.next]o492:0:0 > 0 && o495[LinkedList$Entry.previous]o495:0:0 > 0 && o495[LinkedList$Entry.previous]o492:0:0 > 0 && i345:0:0 > -1 && i369:0:0 > i345:0:0 && i355:0:0 > 0 && i369:0:0 > -1) 10.41/3.62 10.41/3.62 10.41/3.62 ---------------------------------------- 10.41/3.62 10.41/3.62 (18) 10.41/3.62 YES 10.45/3.72 EOF