Class Stacks


  • @Deprecated
    public class Stacks
    extends java.lang.Object
    Deprecated.
    Utilities to make vanilla lists look like stacks.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Stacks()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static <T> T peek​(int n, java.util.List<T> stack)
      Deprecated.
      Returns the nth most recently added element in the stack.
      static <T> T peek​(java.util.List<T> stack)
      Deprecated.
      Returns the most recently added element in the stack.
      static <T> T pop​(java.util.List<T> stack)
      Deprecated.
      Removes an element from the stack and returns it.
      static <T> void pop​(java.util.List<T> stack, T element)
      Deprecated.
      Removes an element from the stack.
      static <T> void push​(java.util.List<T> stack, T element)
      Deprecated.
      Adds an element to the stack.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Stacks

        private Stacks()
        Deprecated.
    • Method Detail

      • peek

        public static <T> T peek​(java.util.List<T> stack)
        Deprecated.
        Returns the most recently added element in the stack. Throws if the stack is empty.
      • peek

        public static <T> T peek​(int n,
                                 java.util.List<T> stack)
        Deprecated.
        Returns the nth most recently added element in the stack. Throws if the stack is empty.
      • push

        public static <T> void push​(java.util.List<T> stack,
                                    T element)
        Deprecated.
        Adds an element to the stack.
      • pop

        public static <T> void pop​(java.util.List<T> stack,
                                   T element)
        Deprecated.
        Removes an element from the stack. Asserts of the element is not the one last added; throws if the stack is empty.
      • pop

        public static <T> T pop​(java.util.List<T> stack)
        Deprecated.
        Removes an element from the stack and returns it.

        Throws if the stack is empty.