comparator

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparable

type Comparable[T any] interface {
	CompareTo(T) int
}

Comparable method CompareTo(Comparable) should return a negative number when v1 < v2, a positive number when v1 > v2 and zero when v1 == v2.

type Container

type Container[T Comparable[T]] struct {
	Items []T  // container data
	Desc  bool // asc or desc, default asc.
}

func (Container[T]) Len

func (c Container[T]) Len() int

Len implement heap.Interface.

func (Container[T]) Less

func (c Container[T]) Less(i, j int) bool

Less implement heap.Interface.

func (*Container[T]) Pop

func (c *Container[T]) Pop() any

Pop implement heap.Interface.

func (*Container[T]) Push

func (c *Container[T]) Push(x any)

Push implement heap.Interface.

func (Container[T]) Swap

func (c Container[T]) Swap(i, j int)

Swap implement heap.Interface.

type Float32

type Float32 float32

func (Float32) CompareTo

func (v1 Float32) CompareTo(v2 Float32) int

type Float64

type Float64 float64

func (Float64) CompareTo

func (v1 Float64) CompareTo(v2 Float64) int

type Int

type Int int

func (Int) CompareTo

func (v1 Int) CompareTo(v2 Int) int

type Int8

type Int8 int8

func (Int8) CompareTo

func (v1 Int8) CompareTo(v2 Int8) int

type Int16

type Int16 int16

func (Int16) CompareTo

func (v1 Int16) CompareTo(v2 Int16) int

type Int32

type Int32 int32

func (Int32) CompareTo

func (v1 Int32) CompareTo(v2 Int32) int

type Int64

type Int64 int64

func (Int64) CompareTo

func (v1 Int64) CompareTo(v2 Int64) int

type String

type String string

func (String) CompareTo

func (v1 String) CompareTo(v2 String) int

type Time

type Time time.Time

func (Time) CompareTo

func (v1 Time) CompareTo(v2 Time) int

type Uint

type Uint uint

func (Uint) CompareTo

func (v1 Uint) CompareTo(v2 Uint) int

type Uint8

type Uint8 uint8

func (Uint8) CompareTo

func (v1 Uint8) CompareTo(v2 Uint8) int

type Uint16

type Uint16 uint16

func (Uint16) CompareTo

func (v1 Uint16) CompareTo(v2 Uint16) int

type Uint32

type Uint32 uint32

func (Uint32) CompareTo

func (v1 Uint32) CompareTo(v2 Uint32) int

type Uint64

type Uint64 uint64

func (Uint64) CompareTo

func (v1 Uint64) CompareTo(v2 Uint64) int

type Uintptr

type Uintptr uintptr

func (Uintptr) CompareTo

func (v1 Uintptr) CompareTo(v2 Uintptr) int

Jump to

Keyboard shortcuts

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