Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Float64Stack ¶
type Float64Stack struct {
// contains filtered or unexported fields
}
Float64Stack integer stack first in last out safe for concurrent usage
Example ¶
stack := NewFloat64Stack() data := []float64{ 1.3, 2.3, 3.3, } for _, d := range data { stack.Push(d) } for stack.Len() > 0 { fmt.Println(stack.Pop()) }
Output: 3.3 2.3 1.3
func (*Float64Stack) Len ¶
func (f *Float64Stack) Len() int
Len gets the number of items pushed into the stack
func (*Float64Stack) Pop ¶
func (f *Float64Stack) Pop() float64
Pop pops the last string from the stack
func (*Float64Stack) Push ¶
func (f *Float64Stack) Push(j float64)
Push pushes new item to the stack
type GenericStack ¶
type GenericStack struct {
// contains filtered or unexported fields
}
GenericStack stack first in last out safe for concurrent usage
Example ¶
stack := NewGenericStack() data := []interface{}{ 1, "a", true, nil, 'b', []string{ "g", "o", }, []int{ 10, 20, 30, }, } for _, d := range data { stack.Push(d) } for stack.Len() > 0 { fmt.Println(stack.Pop()) }
Output: [10 20 30] [g o] 98 <nil> true a 1
func NewGenericStack ¶
func NewGenericStack() *GenericStack
NewGenericStack creates new GenericStack
func (*GenericStack) Len ¶
func (g *GenericStack) Len() int
Len gets the number of items pushed into the stack
func (*GenericStack) Pop ¶
func (g *GenericStack) Pop() interface{}
Pop pops the last interface{} from the stack
func (*GenericStack) Push ¶
func (g *GenericStack) Push(j interface{})
Push pushes new interface{} to the stack
type IntStack ¶
type IntStack struct {
// contains filtered or unexported fields
}
IntStack integer stack first in last out safe for concurrent usage
Example ¶
stack := NewIntStack() data := []int{ 1, 2, 3, } for _, d := range data { stack.Push(d) } for stack.Len() > 0 { fmt.Println(stack.Pop()) }
Output: 3 2 1
type StringStack ¶
type StringStack struct {
// contains filtered or unexported fields
}
StringStack stack first in last out safe for concurrent usage
Example ¶
stack := NewStringStack() data := []string{ "a", "b", "c", } for _, d := range data { stack.Push(d) } for stack.Len() > 0 { fmt.Println(stack.Pop()) }
Output: c b a
func (*StringStack) Len ¶
func (s *StringStack) Len() int
Len gets the number of items pushed into the stack
func (*StringStack) Pop ¶
func (s *StringStack) Pop() string
Pop pops the last string from the stack