collections

package
v0.0.0-...-034a78d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FloatArray

type FloatArray struct {
	// contains filtered or unexported fields
}

FloatArray represents a float array, support mark pos if has value

func NewFloatArray

func NewFloatArray(capacity int) *FloatArray

NewFloatArray creates a float array

func (*FloatArray) GetValue

func (f *FloatArray) GetValue(pos int) float64

GetValue returns value with pos, if has not value return 0

func (*FloatArray) HasValue

func (f *FloatArray) HasValue(pos int) bool

HasValue returns if has value with pos

func (*FloatArray) IsEmpty

func (f *FloatArray) IsEmpty() bool

IsEmpty tests if array is empty

func (*FloatArray) Iterator

func (f *FloatArray) Iterator() *FloatArrayIterator

Iterator returns an iterator over the array

func (*FloatArray) SetValue

func (f *FloatArray) SetValue(pos int, value float64)

SetValue sets value with pos, if pos out of bounds, return it

func (*FloatArray) Size

func (f *FloatArray) Size() int

Size returns size of array

type FloatArrayIterator

type FloatArrayIterator struct {
	// contains filtered or unexported fields
}

FloatArrayIterator represents a float array iterator

func (*FloatArrayIterator) HasNext

func (it *FloatArrayIterator) HasNext() bool

HasNext returns if this iterator has more values

func (*FloatArrayIterator) Next

func (it *FloatArrayIterator) Next() (idx int, value float64)

Next returns the next value and index

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

Stack represents a last-in-first-out(LIFO) stack of interface, using slice saving data. NOTICE: not safe for goroutine concurrent

func NewStack

func NewStack() *Stack

NewStack creates an empty stack

func (*Stack) Empty

func (s *Stack) Empty() bool

Empty tests if this stack is empty

func (*Stack) Peek

func (s *Stack) Peek() interface{}

Peek looks at the element at the top of this stack without removing it from the stack

func (*Stack) Pop

func (s *Stack) Pop() interface{}

Pop removes the element at the top of this stack, if stack is empty return nil

func (*Stack) Push

func (s *Stack) Push(element interface{})

Push pushes an element onto the top of this stack

func (*Stack) Size

func (s *Stack) Size() int

Size returns the number of elements in the stack

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL