From The Odin Project:
You will need two classes or factories:
LinkedListclass / factory, which will represent the full list.Nodeclass / factory, containing avalueproperty and a link to thenextNode, set both asnullby default.
Build the following functions in your linked list class / factory:
append(value)adds a new node containingvalueto the end of the listprepend(value)adds a new node containingvalueto the start of the listsizereturns the total number of nodes in the listheadreturns the first node in the listtailreturns the last node in the listat(index)returns the node at the givenindexpopremoves the last element from the listcontains(value)returns true if the passed in value is in the list and otherwise returns false.find(value)returns the index of the node containing value, or null if not found.toStringrepresents your LinkedList objects as strings, so you can print them out and preview them in the console. The format should be:( value ) -> ( value ) -> ( value ) -> null
insertAt(value, index)that inserts a new node with the providedvalueat the givenindex.removeAt(index)that removes the node at the givenindex.
Extra Credit Tip: When you insert or remove a node, consider how it will affect the existing nodes. Some of the nodes will need their nextNode link updated.