Pop the top item of the stack and return it.
()
| 1012 | |
| 1013 | // Pop the top item of the stack and return it. |
| 1014 | func (stack *Stack) Pop() interface{} { |
| 1015 | e := stack.list.Back() |
| 1016 | if e != nil { |
| 1017 | stack.list.Remove(e) |
| 1018 | return e.Value |
| 1019 | } |
| 1020 | return nil |
| 1021 | } |
| 1022 | |
| 1023 | // Peek view the top item on the stack. |
| 1024 | func (stack *Stack) Peek() interface{} { |
no outgoing calls