/singly-linked-list-java

How to implement a singly linked list in Java

Primary LanguageJava

singly-linked-list-java

How to implement a singly linked list in Java

Class: Node
Methods:
setNext() - sets the current node's next pointer to point to the queried node.
getNext() - return the current node's next pointer.
getValue() - return the current node's value.

Class: SinglyLinkedList
Methods:
append() - adds the queried element to the rear of the linked list.
prepend() - adds the queried element to the front of the linked list.
insert() - adds the queried element to the queried position.
removeFirst() - removes the first element from the linked list.
removeLast() - removes the last element from the linked list.
remove() - removes the element from the queried position in the linked list.
reverse() - reverses the linked list.
print() - prints the linked list.
isEmpty() - check if the linked list is empty.
size() - returnts the size of the linked list.

Class: Main
The main class to test my implementation of a singly linked list.