Different initializing elements in class

A linked list contains many nodes, in your example of class SLLNode<E>. Each node has a reference to a subsequent node (once again, of type SLLNode<E>) and each node contains – usually unique – information. This can be anything; in your code they call this piece of information element of class E. The class E can really represent anything.

As an example, imagine a company that offers tours around a city. The tour consists of 5 highlights around town. In order to keep track of the order at which these highlights are visited, one could implement a singly linked list with nodes of class Highlight<String>. Each highlight would point towards the next highlight, and each highlight contains a description about the highlight embedded into a String.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top