commit deletes
This commit is contained in:
parent
776bba907c
commit
372c577f83
233 changed files with 0 additions and 6724 deletions
|
|
@ -1,18 +0,0 @@
|
|||
class Stack[T]
|
||||
{
|
||||
private var items=List[T]()
|
||||
|
||||
def isEmpty=items.isEmpty
|
||||
|
||||
def peek=items match{
|
||||
case List() => error("Stack empty")
|
||||
case head::rest => head
|
||||
}
|
||||
|
||||
def pop=items match{
|
||||
case List() => error("Stack empty")
|
||||
case head::rest => items=rest; head
|
||||
}
|
||||
|
||||
def push(value:T)=items=value+:items
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue