ArrayList
class is only the tip of the Java collections iceberg. The Java library contains many collections classes, each with its own advantages. This table contains an abbreviated list.
Class Name | Characteristic |
ArrayList | A resizable array. |
LinkedList | A list of values, each having a field that points to the next one in the list. |
Stack | A structure (which grows from bottom to top) that's optimized for access to the topmost value. You can easily add a value to the top or remove it from the top. |
Queue | A structure (which grows at one end) that's optimized for adding values to one end (the rear) and removing values from the other end (the front). |
PriorityQueue | A structure, like a queue, that lets certain (higher-priority) values move toward the front. |
HashSet | A collection containing no duplicate values. |
HashMap | A collection of key/value pairs. |
AbstractCollection
, the ancestor of all collection classes).To find out which collection classes best meet your needs, visit the Android API documentation pages.