2023-07-26 22:13:21 +02:00
|
|
|
package functions
|
|
|
|
|
|
|
|
type (
|
2024-05-28 01:28:25 +02:00
|
|
|
// Consumer takes an argument of type T and returns nothing.
|
2023-07-26 22:13:21 +02:00
|
|
|
Consumer[T any] func(T)
|
|
|
|
|
2024-05-28 01:28:25 +02:00
|
|
|
// Function takes an argument of type T and returns a result of type U.
|
2023-07-26 22:13:21 +02:00
|
|
|
Function[T, U any] func(T) U
|
|
|
|
|
2024-05-28 01:28:25 +02:00
|
|
|
// Predicate takes an argument of type T and returns a boolean result.
|
2023-07-26 22:13:21 +02:00
|
|
|
Predicate[T any] func(T) bool
|
|
|
|
|
2024-05-28 01:28:25 +02:00
|
|
|
// Supplier takes no argument and returns a result of type T.
|
2023-07-26 22:13:21 +02:00
|
|
|
Supplier[T any] func() T
|
|
|
|
|
2024-05-28 01:28:25 +02:00
|
|
|
// UnaryOperator takes an argument of type T and returns a result of type T.
|
2023-07-26 22:13:21 +02:00
|
|
|
UnaryOperator[T any] func(T) T
|
|
|
|
|
2024-05-28 01:28:25 +02:00
|
|
|
// BinaryOperator takes two arguments of type T and returns a result of type T.
|
2023-07-26 22:13:21 +02:00
|
|
|
BinaryOperator[T any] func(T, T) T
|
|
|
|
|
2024-05-28 01:28:25 +02:00
|
|
|
// Comparator takes two arguments of type T and returns a boolean result.
|
2023-07-26 22:13:21 +02:00
|
|
|
Comparator[T any] func(T, T) bool
|
|
|
|
)
|