github.com/tursom/GoCollections@v0.3.10/collections/Stack.go (about) 1 /* 2 * Copyright (c) 2022 tursom. All rights reserved. 3 * Use of this source code is governed by a GPL-3 4 * license that can be found in the LICENSE file. 5 */ 6 7 package collections 8 9 import ( 10 "github.com/tursom/GoCollections/exceptions" 11 ) 12 13 type ( 14 Stack[T any] interface { 15 MutableIterable[T] 16 17 Push(element T) exceptions.Exception 18 PushAndGetNode(element T) (StackNode[T], exceptions.Exception) 19 Pop() (T, exceptions.Exception) 20 } 21 22 StackNode[T any] interface { 23 Set(value T) exceptions.Exception 24 Get() (T, exceptions.Exception) 25 Remove() exceptions.Exception 26 RemoveAndGet() (T, exceptions.Exception) 27 } 28 )