SinglyLinkedList implements PStack<E> { @Override public PStack<E> pop() { return next == null ? EMPTY : next; } private  SinglyLinkedList(E element); private  SinglyLinkedList(E element, SinglyLinkedList<E> next); @Override PStack<E> push(E e); @Override E peek(); @Override E peek(int i); @Override PStack<E> pop(); @Override boolean isEmpty(); @Override void forEach(Consumer<E> action); @Override boolean anyMatch(Predicate<E> predicate); @Override int size(); @Override int hashCode(); @Override String toString(); @Override boolean equals(Object obj);  }
@Test void empty_pop() { PStack<Object> stack = PCollections.emptyStack(); assertThrows(IllegalStateException.class, () -> stack.pop()); }