package Linked;
import java.util.HashSet;
public class LinkedTable {
int size;
Node head =null;
Node tail =null;
public void add(int i){
Node n =new Node(i,null);
if(head==null){
head = n;
tail = n;
}else{
tail.setNext(n);
tail = n;
size++;
}
}
public int size(){
return size;
}
public String visit(){
String i = "";
Node next = head;
while(next!=null){
i = i+next.getData()+"--";
next = next.getNext();
}
return i;
}
}
class Node{
int data;
Node next;
public Node(int data, Node next) {
super();
this.data = data;
this.next = next;
}
public int getData() {
return data;
}
public void setData(int data) {
this.data = data;
}
public Node getNext() {
return next;
}
public void setNext(Node next) {
this.next = next;
}
}