2000-11-22 12:59:59 +01:00
|
|
|
/* List.java -- An ordered collection which allows indexed access
|
2001-10-16 07:47:01 +02:00
|
|
|
Copyright (C) 1998, 2001 Free Software Foundation, Inc.
|
2000-03-17 01:45:06 +01:00
|
|
|
|
2000-11-22 12:59:59 +01:00
|
|
|
This file is part of GNU Classpath.
|
2000-03-17 01:45:06 +01:00
|
|
|
|
2000-11-22 12:59:59 +01:00
|
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the 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, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA.
|
|
|
|
|
|
|
|
As a special exception, if you link this library with other files to
|
|
|
|
produce an executable, this library does not by itself cause the
|
|
|
|
resulting executable to be covered by the GNU General Public License.
|
|
|
|
This exception does not however invalidate any other reasons why the
|
|
|
|
executable file might be covered by the GNU General Public License. */
|
|
|
|
|
|
|
|
|
2000-03-17 01:45:06 +01:00
|
|
|
package java.util;
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* 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
|
2000-03-17 01:45:06 +01:00
|
|
|
*/
|
|
|
|
public interface List extends Collection
|
|
|
|
{
|
2000-11-22 12:59:59 +01:00
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* 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.
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @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 < 0 || index > 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
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
void add(int index, Object o);
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* 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.
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @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
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean add(Object o);
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* 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).
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @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 < 0 || index > 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)
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean addAll(int index, Collection c);
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* 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).
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @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)
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean addAll(Collection c);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the list, such that a subsequent call to isEmpty() would return
|
2001-10-16 07:47:01 +02:00
|
|
|
* true (optional operation).
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @throws UnsupportedOperationException if this list does not support the
|
|
|
|
* clear operation
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test whether this list contains a given object as one of its elements.
|
2001-10-16 07:47:01 +02:00
|
|
|
* This is defined as the existence of an element e such that
|
|
|
|
* <code>o == null ? e == null : o.equals(e)</code>.
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param o the element to look for
|
|
|
|
* @return true if this list contains the element
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean contains(Object o);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test whether this list contains every element in a given collection.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @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)
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
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
|
2001-10-16 07:47:01 +02:00
|
|
|
* lists have the same sequence. Two lists l1 and l2 are equal if and only
|
2000-11-22 12:59:59 +01:00
|
|
|
* 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>.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @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()
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean equals(Object o);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the element at a given index in this list.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param index the index of the element to be returned
|
|
|
|
* @return the element at index index in this list
|
|
|
|
* @throws IndexOutOfBoundsException if index < 0 || index >= size()
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
Object get(int index);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a hash code for this list. In order to obey the general contract of
|
|
|
|
* the hashCode method of class Object, this value is calculated as follows:
|
|
|
|
* <pre>
|
|
|
|
* hashCode = 1;
|
|
|
|
* Iterator i = list.iterator();
|
2001-10-16 07:47:01 +02:00
|
|
|
* while (i.hasNext())
|
|
|
|
* {
|
|
|
|
* Object obj = i.next();
|
|
|
|
* hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode());
|
|
|
|
* }
|
2000-11-22 12:59:59 +01:00
|
|
|
* </pre>
|
|
|
|
* This ensures that the general contract of Object.hashCode() is adhered to.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @return the hash code of this list
|
|
|
|
* @see Object#hashCode()
|
|
|
|
* @see #equals(Object)
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
int hashCode();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the first index at which a given object is to be found in this
|
|
|
|
* list.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param o the object to search for
|
|
|
|
* @return the least integer n such that <code>o == null ? get(n) == null :
|
|
|
|
* o.equals(get(n))</code>, or -1 if there is no such index
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
int indexOf(Object o);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test whether this list is empty, that is, if size() == 0.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @return true if this list contains no elements
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean isEmpty();
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* Obtain an Iterator over this list, whose sequence is the list order.
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @return an Iterator over the elements of this list, in order
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
Iterator iterator();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the last index at which a given object is to be found in this
|
|
|
|
* list.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @return the greatest integer n such that <code>o == null ? get(n) == null
|
|
|
|
* : o.equals(get(n))</code>, or -1 if there is no such index
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
int lastIndexOf(Object o);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a ListIterator over this list, starting at the beginning.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @return a ListIterator over the elements of this list, in order, starting
|
|
|
|
* at the beginning
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
ListIterator listIterator();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a ListIterator over this list, starting at a given position.
|
2001-10-16 07:47:01 +02:00
|
|
|
* A first call to next() would return the same as get(index), and a
|
|
|
|
* first call to previous() would return the same as get(index - 1).
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
|
|
|
* @param index the position, between 0 and size() inclusive, to begin the
|
2001-10-16 07:47:01 +02:00
|
|
|
* iteration from
|
|
|
|
* @return a ListIterator over the elements of this list, in order, starting
|
|
|
|
* at index
|
|
|
|
* @throws IndexOutOfBoundsException if index < 0 || index > size()
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
ListIterator listIterator(int index);
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* Remove the element at a given position in this list (optional operation).
|
|
|
|
* Shifts all remaining elements to the left to fill the gap.
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param index the position within the list of the object to remove
|
|
|
|
* @return the object that was removed
|
|
|
|
* @throws UnsupportedOperationException if this list does not support the
|
|
|
|
* remove operation
|
|
|
|
* @throws IndexOutOfBoundsException if index < 0 || index >= size()
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
Object remove(int index);
|
|
|
|
|
|
|
|
/**
|
HACKING, [...]: Fix spelling errors.
* HACKING, gnu/gcj/xlib/Pixmap.java, gnu/gcj/xlib/XException.java,
gnu/java/rmi/rmic/RMIC.java, java/awt/Window.java,
java/awt/AWTEvent.java, java/io/ByteArrayOutputStream.java,
java/io/CharConversionException.java,
java/io/PipedInputStream.java, java/io/PipedReader.java,
java/io/PrintWriter.java, java/io/WriteAbortedException.java,
java/io/natFileWin32.cc, java/lang/Class.h,
java/lang/natClassLoader.cc, java/lang/natObject.cc,
java/lang/Package.java, java/net/BindException.java,
java/net/ConnectException.java, java/net/ProtocolException.java,
java/net/SocketException.java,
java/net/UnknownServiceException.java,
java/security/cert/X509Certificate.java,
java/security/interfaces/DSAKey.java,
java/security/SecureRandom.java, java/security/SignedObject.java,
java/sql/DatabaseMetaData.java,
java/text/DecimalFormatSymbols.java,
java/util/jar/Attributes.java, java/util/jar/JarEntry.java,
java/util/jar/JarInputStream.java,
java/util/jar/JarOutputStream.java, java/util/Calendar.java,
java/util/Collections.java, java/util/GregorianCalendar.java,
java/util/HashMap.java, java/util/List.java,
java/util/Properties.java, java/util/Timer.java,
java/util/Vector.java, java/util/WeakHashMap.java,
javax/naming/NamingException.java,
testsuite/libjava.lang/Thread_Wait.java,
org/xml/sax/helpers/DefaultHandler.java,
org/xml/sax/HandlerBase.java, org/xml/sax/SAXParseException.java,
ChangeLog, acinclude.m4, aclocal.m4, posix-threads.cc: Fix
spelling errors.
* configure: Regenerate.
From-SVN: r46665
2001-10-31 01:48:17 +01:00
|
|
|
* Remove the first occurrence of an object from this list (optional
|
2001-10-16 07:47:01 +02:00
|
|
|
* operation). That is, remove the first element e such that
|
|
|
|
* <code>o == null ? e == null : o.equals(e)</code>.
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param o the object to remove
|
|
|
|
* @return true if the list changed as a result of this call, that is, if
|
|
|
|
* the list contained at least one occurrence of o
|
|
|
|
* @throws UnsupportedOperationException if this list does not support the
|
|
|
|
* remove operation
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean remove(Object o);
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* Remove all elements of a given collection from this list (optional
|
|
|
|
* operation). That is, remove every element e such that c.contains(e).
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param c the collection to filter out
|
|
|
|
* @return true if this list was modified as a result of this call
|
|
|
|
* @throws UnsupportedOperationException if this list does not support the
|
|
|
|
* removeAll operation
|
|
|
|
* @throws NullPointerException if the collection is null
|
|
|
|
* @see #remove(Object)
|
|
|
|
* @see #contains(Object)
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean removeAll(Collection c);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove all elements of this list that are not contained in a given
|
2001-10-16 07:47:01 +02:00
|
|
|
* collection (optional operation). That is, remove every element e such
|
|
|
|
* that !c.contains(e).
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param c the collection to retain
|
|
|
|
* @return true if this list was modified as a result of this call
|
|
|
|
* @throws UnsupportedOperationException if this list does not support the
|
|
|
|
* retainAll operation
|
|
|
|
* @throws NullPointerException if the collection is null
|
|
|
|
* @see #remove(Object)
|
|
|
|
* @see #contains(Object)
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
boolean retainAll(Collection c);
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* Replace an element of this list with another object (optional operation).
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param index the position within this list of the element to be replaced
|
|
|
|
* @param o the object to replace it with
|
|
|
|
* @return the object that was replaced
|
|
|
|
* @throws UnsupportedOperationException if this list does not support the
|
|
|
|
* set operation
|
|
|
|
* @throws IndexOutOfBoundsException if index < 0 || index >= 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
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
Object set(int index, Object o);
|
|
|
|
|
|
|
|
/**
|
2001-10-16 07:47:01 +02:00
|
|
|
* Get the number of elements in this list. If the list contains more
|
|
|
|
* than Integer.MAX_VALUE elements, return Integer.MAX_VALUE.
|
2000-11-22 12:59:59 +01:00
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @return the number of elements in the list
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
int size();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a List view of a subsection of this list, from fromIndex
|
2001-10-16 07:47:01 +02:00
|
|
|
* (inclusive) to toIndex (exclusive). If the two indices are equal, the
|
|
|
|
* sublist is empty. The returned list should be modifiable if and only
|
|
|
|
* if this list is modifiable. Changes to the returned list should be
|
|
|
|
* reflected in this list. If this list is structurally modified in
|
2000-11-22 12:59:59 +01:00
|
|
|
* any way other than through the returned list, the result of any subsequent
|
|
|
|
* operations on the returned list is undefined.
|
|
|
|
*
|
|
|
|
* @param fromIndex the index that the returned list should start from
|
2001-10-16 07:47:01 +02:00
|
|
|
* (inclusive)
|
|
|
|
* @param toIndex the index that the returned list should go to (exclusive)
|
|
|
|
* @return a List backed by a subsection of this list
|
|
|
|
* @throws IndexOutOfBoundsException if fromIndex < 0
|
|
|
|
* || toIndex > size() || fromIndex > toIndex
|
|
|
|
* @throws IllegalArgumentException if fromIndex > toIndex (according to
|
|
|
|
* AbstractList). Don't you love Sun's inconsistent specifications?
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
List subList(int fromIndex, int toIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy the current contents of this list into an array.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @return an array of type Object[] and length equal to the length of this
|
|
|
|
* list, containing the elements currently in this list, in order
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
Object[] toArray();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copy the current contents of this list into an array. If the array passed
|
|
|
|
* as an argument has length less than that of this list, an array of the
|
|
|
|
* same run-time type as a, and length equal to the length of this list, is
|
|
|
|
* allocated using Reflection. Otherwise, a itself is used. The elements of
|
|
|
|
* this list are copied into it, and if there is space in the array, the
|
|
|
|
* following element is set to null. The resultant array is returned.
|
|
|
|
* Note: The fact that the following element is set to null is only useful
|
|
|
|
* if it is known that this list does not contain any null elements.
|
|
|
|
*
|
2001-10-16 07:47:01 +02:00
|
|
|
* @param a the array to copy this list into
|
|
|
|
* @return an array containing the elements currently in this list, in
|
|
|
|
* order
|
|
|
|
* @throws ArrayStoreException if the type of any element of the
|
|
|
|
* collection is not a subtype of the element type of a
|
|
|
|
* @throws NullPointerException if the specified array is null
|
2000-11-22 12:59:59 +01:00
|
|
|
*/
|
|
|
|
Object[] toArray(Object[] a);
|
2000-03-17 01:45:06 +01:00
|
|
|
}
|