sorted

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: LGPL-3.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 Cmp

type Cmp func(a interface{}, b interface{}) int

Cmp function, a < b -> -1, a == b -> 0, a > b -> 1

type Equal added in v0.1.2

type Equal func(a interface{}, b interface{}) bool

Equal returns true if a and b are deemed the same, false otherwise

type Slice

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

Slice is a sorted array

func NewSlice

func NewSlice(cmp Cmp, eq Equal) *Slice

NewSlice return a new slice

func (*Slice) AddSliceItem

func (s *Slice) AddSliceItem(item interface{}) []interface{}

func (*Slice) AddSliceSlice

func (s *Slice) AddSliceSlice(slice []interface{}) []interface{}

func (*Slice) Del

func (s *Slice) Del(val interface{})

Del the given value

func (*Slice) Get

func (s *Slice) Get() []interface{}

func (*Slice) GetSliceCmp

func (s *Slice) GetSliceCmp() Cmp

func (*Slice) Index

func (s *Slice) Index(index int) interface{}

Index return the value at the given value

func (*Slice) Left

func (s *Slice) Left() interface{}

Left return the min value, not pop out

func (*Slice) Len

func (s *Slice) Len() int

Len return the length of slice

func (*Slice) PopLeft

func (s *Slice) PopLeft() interface{}

PopLeft pop out the min value

func (*Slice) PopRight

func (s *Slice) PopRight() interface{}

PopRight pop out the max value

func (*Slice) Push

func (s *Slice) Push(val interface{})

Push a new value into slice

func (*Slice) Right

func (s *Slice) Right() interface{}

Right return the max value, not pop out

func (*Slice) Set

func (s *Slice) Set(slice []interface{})

Jump to

Keyboard shortcuts

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