Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DerefOrValue ¶
func DerefOrValue[T any](v *T, defaultVal T) *T
DerefOrValue returns v if it is not nil, otherwise returns a pointer to defaultVal.
func Max ¶
func Max[T ComparableNumber](v T, vs ...T) T
Max returns the largest value among v and vs.
func Min ¶
func Min[T ComparableNumber](v T, vs ...T) T
Min returns the smallest element among v and vs.
func ValueOrDefault ¶
func ValueOrDefault[T comparable](v T, defaultVal T) T
ValueOrDefault returns v if it isn't the default value of T, and otherwise returns defaultVal.
Types ¶
type ComparableNumber ¶
type Number ¶
type Number interface { ComparableNumber | float32 | float64 }
type Set ¶
type Set[T comparable] map[T]struct{}
func (Set[T]) Equal ¶
Equal returns true if s and s2 are of equal length and all elements contained in one set are contained in the other.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.