Index
Overview


Hi, I'm "LinkedList".

This page will use "data" and "element" interchangeably.

I provide the services specified on the DynamicList ADT.

My core input methods like "addLast", "addFirst", receive a "data" object parameter. For example if my elements are City objects, then I would be sent a message with this sort of pattern -- "addLast(aCity)".

I privately use "nodes" to hold data. I couldn't do it without nodes. If I have 1,000 elements that means I have 1,000 nodes (each node holds one element). I say "privately" because I will not return nodes to public messages I receive -- however, I will return data.

Concepts


Object Diagram
I have it easy -- I only have three ivars:

  • size
  • firstNode
  • lastNode
Empty (Size Zero)
It is helpful to visualize me when I am "empty".
Size One
That's me with one element.
Size Many
Just another sketch of me again -- this time I have many elements.


Object Diagram


Object Diagram
Yes, an object diagram of me is this simple -- only three instance variables.