Section 21.4 Linked Lists
• A linked list is accessed via a reference to the first node of the list. Each subsequent node is accessed via the link-reference member stored in the previous node.
• By convention, the link reference in the last node of a list is set to null to mark the end of the list.
• A node can contain data of any type, including objects of other classes.
• A linked list is appropriate when the number of data elements to be stored is unpredictable. Linked lists are dynamic, so the length of a list can increase or decrease as necessary.
• The size of a “conventional” Java array cannot be altered—it’s fixed at creation time.
• List nodes normally are not stored in contiguous memory. Rather, they’re logically contiguous.
• Packages ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access