|
scala> val stack = new scala.collection.mutable.Stack[Int] |
|
stack: scala.collection.mutable.Stack[Int] = Stack() |
|
scala> stack.push(1) |
|
res0: stack.type = Stack(1) |
|
scala> stack |
|
res1: scala.collection.mutable.Stack[Int] = Stack(1) |
|
scala> stack.push(2) |
|
res0: stack.type = Stack(1, 2) |
|
scala> stack |
|
res3: scala.collection.mutable.Stack[Int] = Stack(1, 2) |
|
scala> stack.top |
|
res8: Int = 2 |
|
scala> stack |
|
res9: scala.collection.mutable.Stack[Int] = Stack(1, 2) |
|
scala> stack.pop |
|
res10: Int = 2 |
|
scala> stack |
|
res11: scala.collection.mutable.Stack[Int] = Stack(1) |