Scala Library
|
|
class
ArrayStack[T](private
table : Array[AnyRef], private
index : Int)
extends
Collection[T]Additional Constructor Summary | |
def
|
this : ArrayStack[T] |
Method Summary | |
def
|
++=
(x : Iterable[T]) : Unit
Pushes all the provided elements onto the stack.
|
def
|
++=
(x : Iterator[T]) : Unit
Pushes all the provided elements onto the stack.
|
def
|
+=
(x : T) : Unit
Alias for push.
|
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.
|
def
|
elements
: Iterator[T]
Iterates over the stack in fifo order.
|
override def
|
foreach
(f : (T) => Unit) : Unit
Apply a function
f to all elements of this
iterable object. |
override def
|
isEmpty
: Boolean
Is this collection empty?
|
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.
|
def
|
size
: Int
Returns the number of elements in this collection.
|
Methods inherited from Collection | |
toArray, toString, stringPrefix |
Methods inherited from Iterable | |
concat, ++, map, flatMap, filter, partition, takeWhile, dropWhile, take, drop, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, copyToBuffer, sameElements, toList, toSeq, toStream, mkString, mkString, mkString, addString, addString, addString, copyToArray, projection, hasDefiniteSize |
Methods inherited from AnyRef | |
getClass, hashCode, equals, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Additional Constructor Details |
Method Details |
x -
The element to push
def
pop : T
def
peek : T
def
dup : Unit
def
clear : Unit
f -
The function to drain to.x -
The source of elements to pushx -
The source of elements to pushx -
The element to pushf -
The combining function
def
size : Int
action -
The action to run.override
def
isEmpty : Boolean
f
to all elements of this
iterable object.f -
a function that is applied to every element.override
def
clone : ArrayStack[T]
The default implementation of the clone
method is platform dependent.
Scala Library
|
|