RosettaCodeData/Task/Stack/Scala/stack-2.scala
Ingy döt Net 776bba907c Sync
2013-10-27 22:24:23 +00:00

9 lines
221 B
Scala

import collection.mutable.{ Stack => Stak }
class Stack[T] extends Stak[T] {
override def pop: T = {
if (this.length == 0) error("Can't Pop from an empty Stack.")
else super.pop
}
def peek: T = this.head
}