in scala.collection.immutable
class Stack

[scala.serializable]
`class` Stack [A]
  `extends` java.lang.Object
  `with` scala.Seq[A]
  `with` scala.ScalaObject

  This class implements immutable stacks using a list-based data structure. Instances of `Stack` represent empty stacks; they can be either created by calling the constructor directly, or by applying the function `Stack.Empty`.

Author:
  Matthias Zenger
Version:
  1.0, 10/07/2003

Direct Known Subclasses:
  Node

Class Summary
`protected` | `class` Node [B >: A]

Constructor Summary
| `def` this

Def Summary
| `def` + [B >: A] (elem: B) : scala.collection.immutable.Stack[B] Push an element on the stack.
| `def` + [B >: A] (elems: scala.Iterable[B]) : scala.collection.immutable.Stack[B] Push all elements provided by the given iterable object onto the stack. The last element returned by the iterable object will be on top of the new stack.
| `def` apply (n: scala.Int) : A Returns the n-th element of this stack. The top element has index 0, elements below are indexed with increasing numbers.
| `def` elements : scala.Iterator[A] Returns an iterator over all elements on the stack. The iterator issues elements in the reversed order they were inserted into the stack (LIFO order).
`override` | `def` equals (obj: scala.Any) : scala.Boolean Compares this stack with the given object.
`override` | `def` hashCode : scala.Int Returns the hash code for this stack.
`override` | `def` isEmpty : scala.Boolean Checks if this stack is empty.
| `def` length : scala.Int Returns the size of this stack.
| `def` pop : scala.collection.immutable.Stack[A] Removes the top element from the stack.
| `def` push [B >: A] (elems: B*) : scala.collection.immutable.Stack[B] Push a sequence of elements onto the stack. The last element of the sequence will be on top of the new stack.
`override` | `def` stringPrefix : java.lang.String Redefines the prefix of the string representation.
| `def` top : A Returns the top element of the stack. An error is signaled if there is no element on the stack.

Def inherited from scala.Seq[A]
++ , concat, contains, copyToArray, drop, dropWhile, filter, flatMap, isDefinedAt, isEmpty, lastIndexOf, length, map, reverse, slice, stringPrefix, subseq, super$drop, super$dropWhile, super$filter, super$take, super$takeWhile, take, takeWhile, toArray, toString

Constructor Detail

`def` this

Def Detail

`def` + [B >: A](elem: B): scala.collection.immutable.Stack[B]

  Push an element on the stack.

Parameters:
  `elem -` the element to push on the stack.
Returns:
  the stack with the new element on top.

`def` + [B >: A](elems: scala.Iterable[B]): scala.collection.immutable.Stack[B]

  Push all elements provided by the given iterable object onto the stack. The last element returned by the iterable object will be on top of the new stack.

Parameters:
  `elems -` the iterable object.
Returns:
  the stack with the new elements on top.

`def` apply (n: scala.Int): A

  Returns the n-th element of this stack. The top element has index 0, elements below are indexed with increasing numbers.

Parameters:
  `n -` the index number.
Returns:
  the n-th element on the stack.

`def` elements : scala.Iterator[A]

  Returns an iterator over all elements on the stack. The iterator issues elements in the reversed order they were inserted into the stack (LIFO order).

Returns:
  an iterator over all stack elements.

`override def` equals (obj: scala.Any): scala.Boolean

  Compares this stack with the given object.

Returns:
  true, iff the two stacks are equal; i.e. they contain the same elements in the same order.

`override def` hashCode : scala.Int

  Returns the hash code for this stack.

Returns:
  the hash code of the stack.

`override def` isEmpty : scala.Boolean

  Checks if this stack is empty.

Returns:
  true, iff there is no element on the stack.

`def` length : scala.Int

  Returns the size of this stack.

Returns:
  the stack size.

`def` pop : scala.collection.immutable.Stack[A]

  Removes the top element from the stack.

Returns:
  the new stack without the former top element.

`def` push [B >: A](elems: B*): scala.collection.immutable.Stack[B]

  Push a sequence of elements onto the stack. The last element of the sequence will be on top of the new stack.

Parameters:
  `elems -` the element sequence.
Returns:
  the stack with the new elements on top.

`override def` stringPrefix : java.lang.String

  Redefines the prefix of the string representation.

`def` top : A

  Returns the top element of the stack. An error is signaled if there is no element on the stack.

Returns:
  the top element.