mirror of https://github.com/emirpasic/gods
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
510 B
Go
18 lines
510 B
Go
10 years ago
|
package examples
|
||
|
|
||
|
import "github.com/emirpasic/gods/stacks/arraystack"
|
||
|
|
||
|
func arraystackExample() {
|
||
|
stack := arraystack.New() // empty
|
||
|
stack.Push(1) // 1
|
||
|
stack.Push(2) // 1, 2
|
||
|
_, _ = stack.Peek() // 2,true
|
||
|
_, _ = stack.Pop() // 2, true
|
||
|
_, _ = stack.Pop() // 1, true
|
||
|
_, _ = stack.Pop() // nil, false (nothing to pop)
|
||
|
stack.Push(1) // 1
|
||
|
stack.Clear() // empty
|
||
|
stack.Empty() // true
|
||
|
stack.Size() // 0
|
||
|
}
|