1   /*
2    * %W% %E%
3    *
4    * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5    * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6    */
7   
8   package java.util;
9   
10  /**
11   * Marker interface used by <tt>List</tt> implementations to indicate that
12   * they support fast (generally constant time) random access.  The primary
13   * purpose of this interface is to allow generic algorithms to alter their
14   * behavior to provide good performance when applied to either random or
15   * sequential access lists.
16   *
17   * <p>The best algorithms for manipulating random access lists (such as
18   * <tt>ArrayList</tt>) can produce quadratic behavior when applied to
19   * sequential access lists (such as <tt>LinkedList</tt>).  Generic list
20   * algorithms are encouraged to check whether the given list is an
21   * <tt>instanceof</tt> this interface before applying an algorithm that would
22   * provide poor performance if it were applied to a sequential access list,
23   * and to alter their behavior if necessary to guarantee acceptable
24   * performance.
25   * 
26   * <p>It is recognized that the distinction between random and sequential
27   * access is often fuzzy.  For example, some <tt>List</tt> implementations
28   * provide asymptotically linear access times if they get huge, but constant
29   * access times in practice.  Such a <tt>List</tt> implementation
30   * should generally implement this interface.  As a rule of thumb, a
31   * <tt>List</tt> implementation should implement this interface if,
32   * for typical instances of the class, this loop:
33   * <pre>
34   *     for (int i=0, n=list.size(); i &lt; n; i++)
35   *         list.get(i);
36   * </pre>
37   * runs faster than this loop:
38   * <pre>
39   *     for (Iterator i=list.iterator(); i.hasNext(); )
40   *         i.next();
41   * </pre>
42   *
43   * <p>This interface is a member of the 
44   * <a href="{@docRoot}/../technotes/guides/collections/index.html">
45   * Java Collections Framework</a>.
46   *
47   * @since 1.4
48   */
49  public interface RandomAccess {
50  }
51