public class MyStack<AnyType> { // Declare member variables here /** * Construct
ID: 670916 • Letter: P
Question
public class MyStack<AnyType> { // Declare member variables here /** * Construct an empty Stack. */ public MyStack( ){ // TODO: Implement Default Constructor } /** * Empties the list and change the size of this collection to zero. */ private void clear( ){ // TODO: Implement Clear } /** * Returns the number of items in this collection. */ public int size( ) { // TODO: Implement size return 0; } public boolean isEmpty( ) { // TODO: Implement check if list is empty return false; } // Simple push to top of stack of x. public void push( AnyType x ) { // TODO: Implement pushing element onto stack } // returns what is on the top of stack public AnyType peek( ) throws java.util.NoSuchElementException { // TODO: Implement checking the top of the stack return null; } // returns top of stack and removes item public AnyType pop( ) throws java.util.NoSuchElementException { // TODO: Implement removing the top item of the stack return null; } /** * This is the singly-linked list node. */ private class Node<AnyType> { public AnyType data; public Node<AnyType> next; public Node(AnyType d, Node<AnyType> n) { data = d; next = n; } } } Please Help
Explanation / Answer
size--;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.