Scala Library
|
|
class
ArrayStack[T](private
table : Array[AnyRef], private
index : Int)
extends
Seq[T] with
Cloneable[ArrayStack[T]]Additional Constructor Summary | |
def
|
this : ArrayStack[T] |
Method Summary | |
def
|
++=
(x : Iterator[T]) : ArrayStack[T]
Pushes all the provided elements onto the stack.
|
def
|
++=
(x : Iterable[T]) : ArrayStack[T]
Pushes all the provided elements onto the stack.
|
def
|
+=
(x : T) : ArrayStack[T]
Alias for push.
|
def
|
apply
(n : Int) : T
Retrieve n'th element from stack, where top of stack has index 0
|
def
|
clear
: Unit
Empties the stack.
|
override def
|
clone
: ArrayStack[T]
This method creates and returns a copy of the receiver object.
|
def
|
combine
(f : (T, T) => T) : Unit
Pop the top two elements off the stack, apply f to them and push the result
back on to the stack.
|
def
|
drain
(f : (T) => Unit) : Unit
Empties the stack, passing all elements on it in FIFO order to the
provided function.
|
def
|
dup
: Unit
Duplicate the top element of the stack.
|
override def
|
foreach
[U](f : (T) => U) : Unit
Apply a function
f to all elements of this
iterable object. |
override def
|
isEmpty
: Boolean
Does this iterable contain no elements?
|
def
|
iterator
: Iterator[T]
Iterates over the stack in LIFO order.
|
def
|
length
: Int
The number of elements in the stack
|
def
|
peek
: T
View the top element of the stack.
|
def
|
pop
: T
Pop the top element off the stack.
|
def
|
preserving
[T](action : => T) : T
Evaluates the expression, preserving the contents of the stack so that
any changes the evaluation makes to the stack contents will be undone after
it completes.
|
def
|
push
(x : T) : Unit
Push an element onto the stack.
|
def
|
reduceWith
(f : (T, T) => T) : Unit
Repeatedly combine the top elements of the stack until the stack contains only
one element.
|
override def
|
size
: Int
Should always be
length |
def
|
top
: T
View the top element of the stack.
|
Methods inherited from Seq | |
companion |
Methods inherited from SeqLike | |
thisCollection, toCollection, lengthCompare, 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, toString, findLastIndexOf, equalsWith, containsSlice, projection |
Methods inherited from IterableLike | |
elements, 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, toList, 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 |
Additional Constructor Details |
Method Details |
def
length : Int
x -
The element to push
def
pop : T
def
peek : T
def
top : T
def
dup : Unit
def
clear : Unit
f -
The function to drain to.
def
++=(x : Iterable[T]) : ArrayStack[T]
x -
The source of elements to push
def
++=(x : Iterator[T]) : ArrayStack[T]
x -
The source of elements to push
def
+=(x : T) : ArrayStack[T]
x -
The element to pushf -
The combining functionoverride
def
size : Int
length
action -
The action to run.override
def
isEmpty : Boolean
f
to all elements of this
iterable object.f -
A function that is applied for its side-effect to every element. The result (of arbitrary type U) of function `f` is discarded.override
def
clone : ArrayStack[T]
The default implementation of the clone
method is platform dependent.
Scala Library
|
|