rendered paste bodypublic class wineList
{
private wineNode head;
//private wineNode q;
public wineList()
{
this.head = null;
//this.q = null;
}
public wineList(wineNode element)
{
this.head = element;
//this.q = element;
//q.setNext(null);
}
private boolean isEmpty()
{
if(head == null)
return true;
else return false;
}
public void push(wineNode element)
{
if(isEmpty())
{
//this.q = element;
//q.setNext(null);
this.head = element;
head.setNext(null);
}
else
{
//this.q = element;
//q.setNext(head);
element.setNext(head);
this.head = element;
}
}
public void pop()
{
if(!isEmpty())
{
//this.q = head;
this.head = head.getNext();
//q.setNext(null);
}
else System.out.println("Cannot pop, list is empty");
}
public void printList()
{
wineNode q = head;
while(q.getNext() != null)
{
q = this.head;
System.out.println(q.toString());
q = q.getNext();
}
}
}