scala.collection.mutable

class SynchronizedStack

[source: scala/collection/mutable/SynchronizedStack.scala]

class SynchronizedStack[A]
extends Stack[A]
This is a synchronized version of the Stack[T] class. It implements a data structure which allows to store and retrieve objects in a last-in-first-out (LIFO) fashion.
Author
Matthias Zenger
Version
1.0, 03/05/2004
Method Summary
override def ++= (iter : Iterable[A]) : Unit
Pushes all elements provided by an Iterable object on top of the stack. The elements are pushed in the order they are given out by the iterator.
override def ++= (it : Iterator[A]) : Unit
Pushes all elements provided by an iterator on top of the stack. The elements are pushed in the order they are given out by the iterator.
override def += (elem : A) : Unit
Pushes a single element on top of the stack.
override def clear : Unit
Removes all elements from the stack. After this operation completed, the stack will be empty.
override def elements : Iterator[A]
Returns an iterator over all elements on the stack. This iterator is stable with respect to state changes in the stack object; i.e. such changes will not be reflected in the iterator. The iterator issues elements in the order they were inserted into the stack (FIFO order).
override def equals (that : Any) : Boolean
Checks if two stacks are structurally identical.
override def hashCode : Int
The hashCode method always yields an error, since it is not safe to use mutable stacks as keys in hash tables.
override def isEmpty : Boolean
Checks if the stack is empty.
override def pop : A
Removes the top element from the stack.
override def push (elems : A*) : Unit
Pushes a sequence of elements on top of the stack. The first element is pushed first, etc.
override def toList : List[A]
Creates a list of all stack elements in FIFO order.
override def toString : java.lang.String
Returns a textual representation of a stack as a string.
override def top : A
Returns the top element of the stack. This method will not remove the element from the stack. An error is signaled if there is no element on the stack.
Methods inherited from Stack
length, apply, clone, stringPrefix
Methods inherited from Seq
lengthCompare, size, concat, last, lastOption, first, firstOption, headOption, ++, isDefinedAt, lastIndexOf, findIndexOf, indexOf, map, flatMap, filter, take, drop, slice, slice, takeWhile, dropWhile, reverse, contains, subseq, toArray, toSeq, projection, equalsWith, startsWith, startsWith, endsWith, indexOf, containsSlice
Methods inherited from Iterable
partition, foreach, forall, exists, find, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toStream, mkString, mkString, mkString, addString, addString, addString, copyToArray, hasDefiniteSize
Methods inherited from PartialFunction
orElse, andThen
Methods inherited from Function1
compose
Methods inherited from AnyRef
getClass, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def isEmpty : Boolean
Checks if the stack is empty.
Returns
true, iff there is no element on the stack
Overrides
Stack.isEmpty

override def +=(elem : A) : Unit
Pushes a single element on top of the stack.
Parameters
elem - the element to push onto the stack
Overrides
Stack.+=

override def ++=(iter : Iterable[A]) : Unit
Pushes all elements provided by an Iterable object on top of the stack. The elements are pushed in the order they are given out by the iterator.
Parameters
iter - an iterable object
Overrides
Stack.++=

override def ++=(it : Iterator[A]) : Unit
Pushes all elements provided by an iterator on top of the stack. The elements are pushed in the order they are given out by the iterator.
Parameters
iter - an iterator
Overrides
Stack.++=

override def push(elems : A*) : Unit
Pushes a sequence of elements on top of the stack. The first element is pushed first, etc.
Parameters
elems - a sequence of elements
Overrides
Stack.push

override def top : A
Returns the top element of the stack. This method will not remove the element from the stack. An error is signaled if there is no element on the stack.
Returns
the top element
Overrides
Stack.top

override def pop : A
Removes the top element from the stack.
Overrides
Stack.pop

override def clear : Unit
Removes all elements from the stack. After this operation completed, the stack will be empty.
Overrides
Stack.clear

override def elements : Iterator[A]
Returns an iterator over all elements on the stack. This iterator is stable with respect to state changes in the stack object; i.e. such changes will not be reflected in the iterator. The iterator issues elements in the order they were inserted into the stack (FIFO order).
Returns
an iterator over all stack elements.
Overrides
Stack.elements

override def toList : List[A]
Creates a list of all stack elements in FIFO order.
Returns
the created list.
Overrides
Stack.toList

override def equals(that : Any) : Boolean
Checks if two stacks are structurally identical.
Returns
true, iff both stacks contain the same sequence of elements.
Overrides
Stack.equals

override def hashCode : Int
The hashCode method always yields an error, since it is not safe to use mutable stacks as keys in hash tables.
Returns
never.
Overrides
Stack.hashCode

override def toString : java.lang.String
Returns a textual representation of a stack as a string.
Returns
the string representation of this stack.