RosettaCodeData/Task/Stack/Scala/stack-2.scala

10 lines
221 B
Scala
Raw Permalink Normal View History

2013-10-27 22:24:23 +00:00
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
}