Java Programming for Android Developers For Dummies, 2nd Edition
Book image
Explore Book Buy On Amazon
Java has many collection classes you can use in your Android app. The 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.
Some Collection Classes
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.
Each collection class has its own set of methods (in addition to the methods that it inherits from AbstractCollection, the ancestor of all collection classes).

To find out which collection classes best meet your needs, visit the Android API documentation pages.

About This Article

This article is from the book:

About the book author:

Barry Burd, PhD, is a professor in the Department of Mathematics and Computer Science at Drew University in Madison, New Jersey. He has lectured at conferences in the United States, Europe, Australia, and Asia. He hosts podcasts and videos about software and other technology topics. He is the author of many articles and books, including Java For Dummies.

This article can be found in the category: