Question: Finish the implementation of SimpleLinkedList so that it satisifies the specification. public class SimpleLinkedList implements List { private Node head = null; @Override public boolean
Finish the implementation of SimpleLinkedList so that it satisifies the specification.
public class SimpleLinkedList,V> implements List { private Node head = null; @Override public boolean add(K key, V value) { if (head == null) { // List is empty Node nn = new Node(key, value); head = nn; } else { Node node = head; while (node.next != null) { node = node.next; } node.next = new Node(key,value); } return true; } @Override public V remove(K key) { // TODO Auto-generated method stub return null; } @Override public V remove(int n) { // TODO Auto-generated method stub return null; } @Override public V remove() { // TODO Auto-generated method stub return null; } @Override public V lookup(K key) { // TODO Auto-generated method stub return null; } @Override public int size() { // TODO Auto-generated method stub return 0; } @Override public V get(int n) { // TODO Auto-generated method stub return null; } private class Node { protected K key; protected V value; protected Node next; Node(K k, V v) { key = k; value = v; next = null; } } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
