mirror of
https://github.com/emirpasic/gods.git
synced 2026-06-14 16:06:42 +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