Interface Stack<T>

Type Parameters:
T - type of Stack entries
All Superinterfaces:
Iterable<T>, StackKernel<T>, Standard<Stack<T>>
All Known Implementing Classes:
Stack1L, Stack2, Stack3, StackSecondary

public interface Stack<T> extends StackKernel<T>
StackKernel enhanced with secondary methods.
  • Method Details

    • top

      T top()
      Reports the top of this.
      Returns:
      the top entry of this
      Aliases:
      reference returned by top
      Requires:
      this /= <>
      Ensures:
      <top> is prefix of this
    • replaceTop

      Replaces the top of this with x, and returns the old top.
      Parameters:
      x - the new top entry
      Returns:
      the old top entry
      Aliases:
      reference x
      Updates:
      this
      Requires:
      this /= <>
      Ensures:
      <replaceTop> is prefix of #this  and
      this = <x> * #this[1, |#this|)
      
    • flip

      void flip()
      Reverses ("flips") this.
      Updates:
      this
      Ensures:
      this = rev(#this)