public class MyQueueImpl implements MyQueue { private Node head; private Node tail; private int size; public MyQueueImpl() { head = null; tail = head; size = 0; } public int pop(){ if (isEmpty()) { throw new RuntimeException("---"); } int result = head.value; head = head.next; size--; return result; } public void push(int num) { if (isEmpty()){ head = new Node(num); tail = head; } else{ tail.next = new Node(num); tail = tail.next; } size++; } public boolean isEmpty() { return size == 0; } }