aicas logoJamaica 3.2 release 62

java.util
Interface RandomAccess

All Known Implementing Classes:
ArrayList, AttributeList, CopyOnWriteArrayList, Stack, Vector

public interface RandomAccess

Marker interface used to inform List implementations that they support fast (usually constant time) random access. This allows generic list algorithms to tailor their behavior based on the list type.

For example, some sorts are n*log(n) on an array, but decay to quadratic time on a linked list. As a rule of thumb, this interface should be used is this loop:
for (int i = 0, n = list.size(); i < n; i++) list.get(i);
runs faster than this loop:
for (Iterator i = list.iterator(); i.hasNext(); ) i.next();

Since:
1.4
See Also:
List
Status:
updated to 1.4


aicas logoJamaica 3.2 release 62

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2008 aicas GmbH. All Rights Reserved.