gcl

package module
v0.0.0-...-18275cc Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 1 Imported by: 0

README

Generics Collection Library

Generics Collection Library (gcl) provides a collection of data structures and operations on top of them in Go.

Documentation

Overview

Package gcl defines common data types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare[T constraints.Ordered](a, b T) int

Compare is a function of types CompareFn, which operates of ordered types. Compare(a, b) equals to: -1 if a < b 0 if a == b +1 if a > b

func Equal

func Equal[T comparable](a, b T) bool

Equal is a function of type EqualFn, which operates on the comparable types.

func Greater

func Greater[T constraints.Ordered](a, b T) bool

Greater is a function of type LessFn, which operates on the comparable types. Greater(a, b) is true if a > b.

func Less

func Less[T constraints.Ordered](a, b T) bool

Less is a function of type LessFn, which operates on the comparable types. Less(a, b) is true if a < b.

Types

type CompareFn

type CompareFn[T1 any, T2 any] func(T1, T2) int

Equal defines a compare function for pairs of any two types.

type EqualFn

type EqualFn[T1 any, T2 any] func(a T1, b T2) bool

Equal defines a equal function for pairs of any two types.

type LessFn

type LessFn[T any] func(a, b T) bool

LessFn defines a less than function for pairs of any type.

type MapElem

type MapElem[K any, V any] struct {
	Key   K
	Value V
}

MapElem is an element in a map data type.

type Number

type Number interface {
	constraints.Integer | constraints.Float | constraints.Complex
}

Number contains all the different numeric types.

type Zipped

type Zipped[T1 any, T2 any] struct {
	First  T1
	Second T2
}

Zipped contains values of two different types. You can access the values through the First and Second fields.

Directories

Path Synopsis
Package gomaps provides iterators for built-in go maps.
Package gomaps provides iterators for built-in go maps.
Package goslices provides iterators and operations for built-in go slices.
Package goslices provides iterators and operations for built-in go slices.
Package iters defines the general iterator interface and provides different operations on top of them.
Package iters defines the general iterator interface and provides different operations on top of them.
Package lists provides a doubly linked list and various functions useful with lists of any type.
Package lists provides a doubly linked list and various functions useful with lists of any type.

Jump to

Keyboard shortcuts

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