comparator

package
v0.0.0-...-749c54f Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package comparator provides types and functions related to comparing values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparator

type Comparator[T any] func(a, b T) int

Comparator is a function type for comparing two values.

It must return

-1 if a is less than b,
 0 if a equals b,
 1 if a is greater than b.

func Reverse

func Reverse[T any](cmp Comparator[T]) Comparator[T]

Reverse returns a new comparator that reverses cmp

Jump to

Keyboard shortcuts

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