⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list.java

📁 this gcc-g++-3.3.1.tar.gz is a source file of gcc, you can learn more about gcc through this codes f
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* List.java -- An ordered collection which allows indexed access   Copyright (C) 1998, 2001 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package java.util;/** * An ordered collection (also known as a list). This collection allows * access to elements by position, as well as control on where elements * are inserted. Unlike sets, duplicate elements are permitted by this * general contract (if a subclass forbids duplicates, this should be * documented). * <p> * * List places additional requirements on <code>iterator</code>, * <code>add</code>, <code>remove</code>, <code>equals</code>, and * <code>hashCode</code>, in addition to requiring more methods. List * indexing is 0-based (like arrays), although some implementations may * require time proportional to the index to obtain an arbitrary element. * The List interface is incompatible with Set; you cannot implement both * simultaneously. * <p> * * Lists also provide a <code>ListIterator</code> which allows bidirectional * traversal and other features atop regular iterators. Lists can be * searched for arbitrary elements, and allow easy insertion and removal * of multiple elements in one method call. * <p> * * Note: While lists may contain themselves as elements, this leads to * undefined (usually infinite recursive) behavior for some methods like * hashCode or equals. * * @author Original author unknown * @author Eric Blake <ebb9@email.byu.edu> * @see Collection * @see Set * @see ArrayList * @see LinkedList * @see Vector * @see Arrays#asList(Object[]) * @see Collections#nCopies(int, Object) * @see Collections#EMPTY_LIST * @see AbstractList * @see AbstractSequentialList * @since 1.2 * @status updated to 1.4 */public interface List extends Collection{  /**   * Insert an element into the list at a given position (optional operation).   * This shifts all existing elements from that position to the end one   * index to the right. This version of add has no return, since it is   * assumed to always succeed if there is no exception.   *   * @param index the location to insert the item   * @param o the object to insert   * @throws UnsupportedOperationException if this list does not support the   *         add operation   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()   * @throws ClassCastException if o cannot be added to this list due to its   *         type   * @throws IllegalArgumentException if o cannot be added to this list for   *         some other reason   */  void add(int index, Object o);  /**   * Add an element to the end of the list (optional operation). If the list   * imposes restraints on what can be inserted, such as no null elements,   * this should be documented.   *   * @param o the object to add   * @return true, as defined by Collection for a modified list   * @throws UnsupportedOperationException if this list does not support the   *         add operation   * @throws ClassCastException if o cannot be added to this list due to its   *         type   * @throws IllegalArgumentException if o cannot be added to this list for   *         some other reason   */  boolean add(Object o);  /**   * Insert the contents of a collection into the list at a given position   * (optional operation). Shift all elements at that position to the right   * by the number of elements inserted. This operation is undefined if   * this list is modified during the operation (for example, if you try   * to insert a list into itself).   *   * @param index the location to insert the collection   * @param c the collection to insert   * @return true if the list was modified by this action, that is, if c is   *         non-empty   * @throws UnsupportedOperationException if this list does not support the   *         addAll operation   * @throws IndexOutOfBoundsException if index &lt; 0 || index &gt; size()   * @throws ClassCastException if some element of c cannot be added to this   *         list due to its type   * @throws IllegalArgumentException if some element of c cannot be added   *         to this list for some other reason   * @throws NullPointerException if the specified collection is null   * @see #add(int, Object)   */  boolean addAll(int index, Collection c);  /**   * Add the contents of a collection to the end of the list (optional   * operation).  This operation is undefined if this list is modified   * during the operation (for example, if you try to insert a list into   * itself).   *   * @param c the collection to add   * @return true if the list was modified by this action, that is, if c is   *         non-empty   * @throws UnsupportedOperationException if this list does not support the   *         addAll operation   * @throws ClassCastException if some element of c cannot be added to this   *         list due to its type   * @throws IllegalArgumentException if some element of c cannot be added   *         to this list for some other reason   * @throws NullPointerException if the specified collection is null   * @see #add(Object)   */  boolean addAll(Collection c);  /**   * Clear the list, such that a subsequent call to isEmpty() would return   * true (optional operation).   *   * @throws UnsupportedOperationException if this list does not support the   *         clear operation   */  void clear();  /**   * Test whether this list contains a given object as one of its elements.   * This is defined as the existence of an element e such that   * <code>o == null ? e == null : o.equals(e)</code>.   *   * @param o the element to look for   * @return true if this list contains the element   */  boolean contains(Object o);  /**   * Test whether this list contains every element in a given collection.   *   * @param c the collection to test for   * @return true if for every element o in c, contains(o) would return true   * @throws NullPointerException if the collection is null   * @see #contains(Object)   */  boolean containsAll(Collection c);  /**   * Test whether this list is equal to another object. A List is defined to be   * equal to an object if and only if that object is also a List, and the two   * lists have the same sequence. Two lists l1 and l2 are equal if and only   * if <code>l1.size() == l2.size()</code>, and for every integer n between 0   * and <code>l1.size() - 1</code> inclusive, <code>l1.get(n) == null ?   * l2.get(n) == null : l1.get(n).equals(l2.get(n))</code>.   *   * @param o the object to test for equality with this list   * @return true if o is equal to this list   * @see Object#equals(Object)   * @see #hashCode()   */  boolean equals(Object o);  /**   * Get the element at a given index in this list.   *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -