0N/A/*
2362N/A * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.util;
0N/A
0N/A/**
0N/A * Marker interface used by <tt>List</tt> implementations to indicate that
0N/A * they support fast (generally constant time) random access. The primary
0N/A * purpose of this interface is to allow generic algorithms to alter their
0N/A * behavior to provide good performance when applied to either random or
0N/A * sequential access lists.
0N/A *
0N/A * <p>The best algorithms for manipulating random access lists (such as
0N/A * <tt>ArrayList</tt>) can produce quadratic behavior when applied to
0N/A * sequential access lists (such as <tt>LinkedList</tt>). Generic list
0N/A * algorithms are encouraged to check whether the given list is an
0N/A * <tt>instanceof</tt> this interface before applying an algorithm that would
0N/A * provide poor performance if it were applied to a sequential access list,
0N/A * and to alter their behavior if necessary to guarantee acceptable
0N/A * performance.
0N/A *
0N/A * <p>It is recognized that the distinction between random and sequential
0N/A * access is often fuzzy. For example, some <tt>List</tt> implementations
0N/A * provide asymptotically linear access times if they get huge, but constant
0N/A * access times in practice. Such a <tt>List</tt> implementation
0N/A * should generally implement this interface. As a rule of thumb, a
0N/A * <tt>List</tt> implementation should implement this interface if,
0N/A * for typical instances of the class, this loop:
0N/A * <pre>
0N/A * for (int i=0, n=list.size(); i &lt; n; i++)
0N/A * list.get(i);
0N/A * </pre>
0N/A * runs faster than this loop:
0N/A * <pre>
0N/A * for (Iterator i=list.iterator(); i.hasNext(); )
0N/A * i.next();
0N/A * </pre>
0N/A *
0N/A * <p>This interface is a member of the
0N/A * <a href="{@docRoot}/../technotes/guides/collections/index.html">
0N/A * Java Collections Framework</a>.
0N/A *
0N/A * @since 1.4
0N/A */
0N/Apublic interface RandomAccess {
0N/A}
0N/A