Code example for Stack

Methods: getsize

0
 
    private static class ElementStack { 
      private final Stack<String> stack = new Stack<String>();
 
      public boolean exactly(String elementName, int depth) {
        return (depth == stack.size() - 1)
            && elementName.equals(stack.get(depth));
      } 
 
      public String peek() {
        return stack.peek();
      } 
 
      public String pop() {
        return stack.pop();
      } 
 
      public void push(String elementName) {
        stack.push(elementName);
      } 
Contextual code suggestions in your IDE  Get Codota for Java