mirror of
https://github.com/emirpasic/gods.git
synced 2026-06-15 16:16:35 +03:00
add Clear() method to stack interface
This commit is contained in:
@@ -88,6 +88,12 @@ func (stack *Stack) Size() int {
|
||||
return stack.top + 1
|
||||
}
|
||||
|
||||
// Removes all elements from the stack.
|
||||
func (stack *Stack) Clear() {
|
||||
stack.top = -1
|
||||
stack.items = []interface{}{}
|
||||
}
|
||||
|
||||
func (stack *Stack) String() string {
|
||||
str := "ArrayStack\n"
|
||||
values := []string{}
|
||||
|
||||
Reference in New Issue
Block a user