import java.util.LinkedList;
import java.util.NoSuchElementException;
import java.util.Objects;
public class DanLianBiao<E> {
private Node<E> first;
public DanLianBiao()
{
first=new Node<>(null,null);
}
public void put(E e){
Node<E> curr=first;
while (curr.next!=null){
curr=curr.next;
}
curr.next=new Node<E>(e,null);
}
public void out(){
Node<E> curr=first;
while (curr.next!=null) {
curr=curr.next;
System.out.println(curr.e); }
}
public E RemoveFirst(){
E remove;
if(first.next!=null) {
remove=first.next.e;
first.next = first.next.next;
return remove;
}
throw new NoSuchElementException();
}
public boolean isExist(E e){
Node<E> curr=first;
while (curr.next!=null)
{
boolean bool=Objects.equals(curr.next.e,e);
if(bool)
return bool;
curr=curr.next;
}
return false;
}
public boolean isEmpty()
{
return first.next==null;
}
private static class Node<E>{
E e;
Node<E> next;
Node(E e,Node<E> next){
this.e=e;
this.next=next;
}
}
}