SimpleLinkedList set
Let's implement a list using a different strategy. Instead of an internal array, we'll link items together into a chain using references. Our list class will only maintain a reference to the start of the list and walk the list to perform list operations. This approach will have interesting tradeoffs compared to our implementation that used arrays.
Starting with the SimpleLinkedList
class below, complete the code for set
.
You'll want to review get
and the rest of the code to understand how this list implementation works and how to
walk a linked list.