Merge git+ssh://davetron5000@repo.or.cz/srv/git/vimdoclet
[vimdoclet.git] / sample / java.util.RandomAccess.txt
blob53155f096f3e80e261e967ce32f149fbdc2de243
1 *java.util.RandomAccess* *RandomAccess* Marker interface used by List implementa
3 public interface interface RandomAccess
6 |java.util.RandomAccess_Description|
7 |java.util.RandomAccess_Fields|
8 |java.util.RandomAccess_Constructors|
9 |java.util.RandomAccess_Methods|
11 ================================================================================
13 *java.util.RandomAccess_Description*
15 Marker interface used by List implementations to indicate that they support 
16 fast (generally constant time) random access. The primary purpose of this 
17 interface is to allow generic algorithms to alter their behavior to provide 
18 good performance when applied to either random or sequential access lists. 
20 The best algorithms for manipulating random access lists (such as ArrayList) 
21 can produce quadratic behavior when applied to sequential access lists (such as 
22 LinkedList). Generic list algorithms are encouraged to check whether the given 
23 list is an instanceof this interface before applying an algorithm that would 
24 provide poor performance if it were applied to a sequential access list, and to 
25 alter their behavior if necessary to guarantee acceptable performance. 
27 It is recognized that the distinction between random and sequential access is 
28 often fuzzy. For example, some List implementations provide asymptotically 
29 linear access times if they get huge, but constant access times in practice. 
30 Such a List implementation should generally implement this interface. As a rule 
31 of thumb, a List implementation should implement this interface if, for typical 
32 instances of the class, this loop: 
34 for (int i=0, n=list.size(); i < n; i++) list.get(i); 
36 runs faster than this loop: 
38 for (Iterator i=list.iterator(); i.hasNext(); ) i.next(); 
40 This interface is a member of the <a href="/../guide/collections/index.html"> 
41 Java Collections Framework.