Array Lists:
•
A collection of variables, all of the same type
•
Each variable in an array is accessed by an index
•
An array occupies a contiguous block of memory
•
Inserting something into this list sometimes involves allocation of a large block of
memory
•
Inserting an item into this list sometimes involves copying of data from one block of
memory to another
•
Memory for storage is allocated for more than one element at a time
•
The size of an array is fixed, specified at creation
•
Finding an item by its index requires constant time
Linked Lists:
•
All insertation operations take the same amount of time
•
If the elements of the list must be kept in order, insertation of an item into this list
is faster
•
If the elements of the list must be kept in order, removal of an item from that list
is faster [ does not work that if not in order, ArrayList would be faster ]
Advantages of an ArrayList
-
Fast access to a specific index
-
Typically less space usages than other options
Disadvantages of an ArrayList
-
Can be expensive to insert items
-
Resizing is an expensive operation
This
preview
has intentionally blurred sections.
Sign up to view the full version.

This is the end of the preview.
Sign up
to
access the rest of the document.
- Spring '09
- Computer Science, Iterator, specific Iterator implementation
-
Click to edit the document details