Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BiFunction ¶
BiFunction like Function, but is accepts two arguments and produces a result
type BinaryOperator ¶
BinaryOperator is a BiFunction which input and result are the same type
type Comparator ¶
Comparator is a BiFunction, which two input arguments are the type, and returns a int. if left is greater then right, it returns a positive number; if left is less then right, it returns a negative number; if the two input are equal, it returns 0
var ( // IntComparator is a Comparator for int IntComparator Comparator = func(left, right T) int { if left.(int) < right.(int) { return -1 } if left.(int) > right.(int) { return 1 } return 0 } // Int64Comparator is a Comparator for int64 Int64Comparator Comparator = func(left, right T) int { if left.(int64) > right.(int64) { return 1 } if left.(int64) < right.(int64) { return -1 } return 0 } )
func ReverseOrder ¶
func ReverseOrder(cmp Comparator) Comparator
ReverseOrder returns the reverse order of the input Comparator
type Function ¶
Function represents a conversion ability, which accepts one argument and produces a result
type IntFunction ¶
IntFunction is a Function, which result type is int
type Predicate ¶
Predicate is a Function, which produces a bool value. usually used to test a value whether satisfied condition
type Supplier ¶
type Supplier func() T
Supplier returns a result. each time invoked it can returns a new or distinct result
type T ¶
type T interface{}
T is a empty interface, that is `any` type. since Go is not support generics now(but will coming soon), so we use T to represent any type
type UnaryOperator ¶
UnaryOperator is a Function, which argument and result are the same type