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
Since
1
Values and Variables inherited from Stack
elems
Method Summary
override def clear : Unit
Removes all elements from the stack. After this operation completed, the stack will be empty.
override def isEmpty : Boolean
Checks if the stack is empty.
override def iterator : 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 pop : A
Removes the top element from the stack.
override def push (elem1 : A, elem2 : A, elems : A*) : SynchronizedStack[A]
Push two or more elements onto the stack. The last element of the sequence will be on top of the new stack.
override def push (elem : A) : SynchronizedStack[A]
Pushes a single element on top of the stack.
override def pushAll (elems : Iterator[A]) : SynchronizedStack[A]
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 pushAll (elems : Traversable[A]) : SynchronizedStack[A]
Pushes all elements provided by an Traversable object on top of the stack. The elements are pushed in the order they are given out by the iterator.
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
Methods inherited from Seq
companion
Methods inherited from SeqLike
thisCollection, toCollection, lengthCompare, size, isDefinedAt, segmentLength, prefixLength, indexWhere, indexWhere, findIndexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, reverse, reverseMap, reverseIterator, reversedElements, startsWith, startsWith, endsWith, indexOfSeq, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, contains, union, diff, intersect, removeDuplicates, patch, updated, +:, :+, padTo, sortWith, sortWith, sortBy, toSeq, indices, view, view, hashCode, equals, findLastIndexOf, equalsWith, containsSlice, projection
Methods inherited from IterableLike
elements, foreach, forall, exists, find, foldRight, reduceRight, toIterable, head, take, slice, takeWhile, takeRight, dropRight, copyToArray, zip, zipAll, zipWithIndex, sameElements, toStream, canEqual, first, firstOption
Methods inherited from GenericTraversableTemplate
newBuilder, genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableLike
repr, nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, count, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, sum, product, min, max, headOption, tail, last, lastOption, init, drop, dropWhile, span, splitAt, copyToBuffer, copyToArray, toArray, toIndexedSeq, toSet, mkString, mkString, mkString, addString, addString, addString, stringPrefix, withFilter
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 push(elem : A) : SynchronizedStack[A]
Pushes a single element on top of the stack.
Parameters
elem - the element to push onto the stack
Overrides
Stack.push

override def push(elem1 : A, elem2 : A, elems : A*) : SynchronizedStack[A]
Push two or more 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.
Overrides
Stack.push

override def pushAll(elems : Traversable[A]) : SynchronizedStack[A]
Pushes all elements provided by an Traversable 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.pushAll

override def pushAll(elems : Iterator[A]) : SynchronizedStack[A]
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
elems - an iterator
Overrides
Stack.pushAll

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 iterator : 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.iterator

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

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