As a demonstration (and because I'm a nerd and find Collections fascinating) this snipped benchmarks one of the differences between LinkedList and ArrayList. This code adds thousands of identical values to instances of both objects, then removes all objects starting at the beginning of the list. Since ArrayList is basically an array, removals at the beginning of the array require copying all subsequent values to their new positions. Linked list requires resetting a single reference (or 'pointer').
public static void main(String[] args){
java.util.List<String> list = new ArrayList<String>();
java.util.List<String> ll = new LinkedList<String>();
final int max = 100000;
for ( int i = 0; i < max; i++ ){
list.add("1");
ll.add("1");
}
long start = System.currentTimeMillis();
for ( int i = 0; i < max; i++ ){
list.remove(0);
}
System.out.println("ArrayList Time: " + (System.currentTimeMillis()- start));
start = System.currentTimeMillis();
for ( int i = 0; i < max; i++ ){
ll.remove(0);
}
System.out.println("LinkedList Time: " + (System.currentTimeMillis()- start));
}
Results:
ArrayList Time: 4290
LinkedList Time: 14
Pushing it to the limit yes, but some occasions are pushed to the limit.