In This Chapter
Introducing linked lists
Comparing linked lists with array lists
Creating linked lists
Adding items to a linked list
Retrieving items from a linked list
Updating and deleting items in a linked list
The ArrayList class, which I cover in the preceding chapter, is a collection class that's based on an array. Arrays have their strengths and their weaknesses. The strength of an array is that it's very efficient — at least until you fill it up or try to reorganize it by inserting or deleting elements. Then it suddenly becomes very inefficient.
Over the years, computer scientists have developed various alternatives to arrays that are more efficient for certain types of access. One of the oldest of these alternatives is the linked list. A linked list is less efficient than an array for tasks such as directly accessing an element based on ...