Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class LinkedList {
- LinkedListNode head;
- public void insert(int value) {
- LinkedListNode node = new LinkedListNode();
- node.value = value;
- node.next = null;
- if (head == null) {
- head = node;
- } else {
- LinkedListNode n = head;
- while (n.next != null) {
- n = n.next;
- }
- n.next = node;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement