Class Stacks

java.lang.Object
org.apache.calcite.util.Stacks

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

    Modifier and Type
    Method
    Description
    static <T> T
    peek(int n, List<T> stack)
    Deprecated.
    Returns the nth most recently added element in the stack.
    static <T> T
    peek(List<T> stack)
    Deprecated.
    Returns the most recently added element in the stack.
    static <T> T
    pop(List<T> stack)
    Deprecated.
    Removes an element from the stack and returns it.
    static <T> void
    pop(List<T> stack, T element)
    Deprecated.
    Removes an element from the stack.
    static <T> void
    push(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
  • Method Details

    • peek

      public static <T> T peek(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, 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(List<T> stack, T element)
      Deprecated.
      Adds an element to the stack.
    • pop

      public static <T> void pop(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(List<T> stack)
      Deprecated.
      Removes an element from the stack and returns it.

      Throws if the stack is empty.