Documentation
¶
Index ¶
- func Asc[L ~[]V, V constraints.Ordered](list L)
- func ConstainsF[L ~[]V, V any](list L, v V, comp function.BiPredicate[V, V]) bool
- func Contains[L ~[]V, V comparable](list L, v V) bool
- func ContainsAny[L ~[]V, V comparable](list L, values ...V) bool
- func ContainsAnyF[L ~[]V, V any](list L, comp function.BiPredicate[V, V], values ...V) bool
- func Desc[L ~[]V, V constraints.Ordered](list L)
- func Distinct[L ~[]V, V comparable](list L) L
- func DistinctF[L ~[]V, V any](list L, comp function.BiPredicate[V, V]) L
- func Filter[L ~[]V, V any](list L, pred function.Predicate[V]) L
- func ForEach[L ~[]V, V any](list L, consumer function.Consumer[V])
- func GetEntrySet[M ~map[K]V, S EntrySet[K, V], K comparable, V any](m M) S
- func Keys[M ~map[K]V, K comparable, V any](m M) []K
- func Map[LI ~[]I, LO []O, I, O any](in LI, mapper function.Func[I, O]) LO
- func Sort[L ~[]V, V any](list L, less func(i, j V) bool)
- func Values[M ~map[K]V, K comparable, V any](m M) []V
- type Entry
- type EntrySet
- type Iterator
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asc ¶
func Asc[L ~[]V, V constraints.Ordered](list L)
Asc is sorting the elements of a slice `list` in ascending order.
func ConstainsF ¶
func ConstainsF[L ~[]V, V any](list L, v V, comp function.BiPredicate[V, V]) bool
ConstainsF returns a boolean value indicating whether there is an element in `list` for which `comp` returns `true` when called with `v` and that element as arguments.
func Contains ¶
func Contains[L ~[]V, V comparable](list L, v V) bool
Contains returns a boolean value indicating whether `v` is present in the slice `list`.
func ContainsAny ¶
func ContainsAny[L ~[]V, V comparable](list L, values ...V) bool
ContainsAny returns a boolean value indicating whether any of the values passed as arguments are present in the slice `list`.
func ContainsAnyF ¶
func ContainsAnyF[L ~[]V, V any](list L, comp function.BiPredicate[V, V], values ...V) bool
ContainsAnyF returns a boolean value indicating whether there is an element in `list` for which `comp` returns `true` when called with `v` and that element as arguments, where `v` is any of the values passed as arguments in `values`.
func Desc ¶
func Desc[L ~[]V, V constraints.Ordered](list L)
Desc is sorting the elements of a slice `list` in descending order.
func Distinct ¶
func Distinct[L ~[]V, V comparable](list L) L
Distinct returns a new slice of type `L` containing only the distinct elements of `list`.
func DistinctF ¶
func DistinctF[L ~[]V, V any](list L, comp function.BiPredicate[V, V]) L
DistinctF returns a new slice of type `L` containing only the distinct elements of `list`, where distinct means that no two elements are equal according to the `comp` function.
func Filter ¶
Filter returns a new slice of type `L` containing only the elements of `list` for which `pred` returns `true`.
func ForEach ¶
ForEach performing a loop over the elements of the slice and applying a function to each element.
func GetEntrySet ¶
func GetEntrySet[M ~map[K]V, S EntrySet[K, V], K comparable, V any](m M) S
func Keys ¶
func Keys[M ~map[K]V, K comparable, V any](m M) []K
func Map ¶
Map returns a new slice of type `LO` containing the result of applying the `mapper` function to each element of the input slice `in`.
func Sort ¶
Sort is sorting the elements of a slice `list` of type `L` containing elements of type `V`, where `V` can be any type.
func Values ¶
func Values[M ~map[K]V, K comparable, V any](m M) []V
Types ¶
type Entry ¶
type Entry[K comparable, V any] struct { // contains filtered or unexported fields }
type EntrySet ¶
type EntrySet[K comparable, V any] []Entry[K, V]
func ConvertToEntrySet ¶
func ConvertToEntrySet[S ~[]Entry[K, V], K comparable, V any](s S) EntrySet[K, V]
type Set ¶
type Set[T any] interface { // Elements returns a slice containing all elements in the set. Elements() []T // Size returns the number of elements in the set. Size() int // Clear removes all elements from the set. Clear() // Add adds an element to the set. Add(element ...T) Set[T] // Remove removes an element from the set. Remove(element ...T) Set[T] // Contains checks if the set contains a specific element. Contains(element T) bool // ContainsAny checks if the set contains any of the specified values. ContainsAny(values ...T) bool // ContainsAll checks if the set contains all of the specified values. ContainsAll(values ...T) bool // Intersection returns a new set containing the elements that are common to both the current set and the input set `ts`. Intersection(ts Set[T]) Set[T] // Union returns a new set containing all the elements that are present in both the current set and the input set `ts`. Union(ts Set[T]) Set[T] // Difference returns a new set containing the elements that are present in the current set but not in the input set `ts`. Difference(ts Set[T]) Set[T] // SymmetricDifference returns a new set containing the elements that are present in either the current set or the input set `ts`, but not in both. SymmetricDifference(ts Set[T]) Set[T] }
func KeySet ¶
func KeySet[M ~map[K]V, K comparable, V any](m M) Set[K]
func NewSet ¶
func NewSet[V comparable](values ...V) Set[V]