14.1 Linked Lists
14.1.1 Linked-List Concepts and Structure
A linked list can be thought of as a chain of linked nodes.
A node is an object with two attributes:
data—The data can be a primitive data type (for example, an int), or it can be a reference to an object of a specified class.
the location of the next node in the chain—We say that a node “points to” or “refers to” the next node.
Figure 14.1 shows how we can visualize a node containing the integer value 5. The arrow points to the next node in the list.
In the last node of the list, the location of the next node contains the value null, to indicate that there ...
Get Java Illuminated, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.