added Clear() method for stacks and queues
This commit is contained in:
parent
a83a8ca68e
commit
f8635b5cf2
@ -41,3 +41,7 @@ func (s *ListQueue[T]) Size() int {
|
||||
func (s *ListQueue[T]) Empty() bool {
|
||||
return s.Size() == 0
|
||||
}
|
||||
|
||||
func (s *ListQueue[T]) Clear() {
|
||||
s.list.Clear()
|
||||
}
|
||||
|
@ -41,3 +41,7 @@ func (s *ListStack[T]) Size() int {
|
||||
func (s *ListStack[T]) Empty() bool {
|
||||
return s.Size() == 0
|
||||
}
|
||||
|
||||
func (s *ListStack[T]) Clear() {
|
||||
s.list.Clear()
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package ds
|
||||
type Queue[T any] interface {
|
||||
Addable[T]
|
||||
Sized
|
||||
Clearable
|
||||
|
||||
Enqueue(value T)
|
||||
Dequeue() T
|
||||
|
@ -3,6 +3,7 @@ package ds
|
||||
type Stack[T any] interface {
|
||||
Addable[T]
|
||||
Sized
|
||||
Clearable
|
||||
|
||||
Push(value T)
|
||||
Pop() T
|
||||
|
Loading…
Reference in New Issue
Block a user