mirror of
https://github.com/tursom/GoCollections.git
synced 2024-12-27 17:10:25 +08:00
29 lines
615 B
Go
29 lines
615 B
Go
/*
|
|
* Copyright (c) 2022 tursom. All rights reserved.
|
|
* Use of this source code is governed by a GPL-3
|
|
* license that can be found in the LICENSE file.
|
|
*/
|
|
|
|
package collections
|
|
|
|
import (
|
|
"github.com/tursom/GoCollections/exceptions"
|
|
)
|
|
|
|
type (
|
|
Stack[T any] interface {
|
|
MutableIterable[T]
|
|
|
|
Push(element T) exceptions.Exception
|
|
PushAndGetNode(element T) (StackNode[T], exceptions.Exception)
|
|
Pop() (T, exceptions.Exception)
|
|
}
|
|
|
|
StackNode[T any] interface {
|
|
Set(value T) exceptions.Exception
|
|
Get() (T, exceptions.Exception)
|
|
Remove() exceptions.Exception
|
|
RemoveAndGet() (T, exceptions.Exception)
|
|
}
|
|
)
|