Documentation
¶
Index ¶
- func AddAll[T any](src types.Collection[T], target types.Collection[T]) intdeprecated
- func AddAllTo[T any](src types.Collection[T], target types.Collection[T]) int
- func AddSliceTo[T any](elems []T, col types.Collection[T])
- func Compute[K any, V any](m types.Map[K, V], k K, fn func(v V, found bool) V) V
- func ComputeIfAbsent[K any, V any](m types.Map[K, V], k K, fn func() V) (V, bool)
- func KeysFrom[K any, V any](m types.Map[K, V]) []K
- func MultiValuesTo[K any, V any](src types.Map[K, types.Collection[V]], tgt types.Collection[V]) int
- func Nil[T any]() (v T)
- func SliceFrom[T any](col types.Collection[T]) []T
- func SliceFromIt[T any](it types.Iterator[T], size int) []T
- func SliceProject[T any, R any](col types.Collection[T], fn func(t T) R) []R
- func SliceProjectIt[T any, R any](it types.Iterator[T], size int, fn func(t T) R) []R
- func Sort[T any](list types.IndexAccess[T], lessFn types.Less[T])
- func SortC[T types.WithLess[T]](list types.IndexAccess[T])
- func SortOrderable[T constraints.Ordered](list types.IndexAccess[T])
- func StringFrom[T any](b types.Collection[T]) *string
- func StringFromf[T any](b types.Collection[T], toStringFn func(elem T) string) *string
- func ValuesFrom[K any, V any](m types.Map[K, V]) []V
- func ValuesFromMulti[K any, V any](m types.Map[K, types.Collection[V]]) []V
- func ValuesTo[K any, V any](src types.Map[K, V], tgt types.Collection[V]) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAll
deprecated
func AddAll[T any](src types.Collection[T], target types.Collection[T]) int
AddAll adds all elems from src collection into target collection, return number of elems actually added
Deprecated: please use AddAllTo, will be removed in future releases
func AddAllTo ¶ added in v1.12.0
func AddAllTo[T any](src types.Collection[T], target types.Collection[T]) int
AddAllTo adds all elems from src collection into target collection, return number of elems actually added
func AddSliceTo ¶
func AddSliceTo[T any](elems []T, col types.Collection[T])
AddSliceTo add all elems from the slice to the collection
func Compute ¶
Compute sets the computed value for the given key by a re-mapping function. Return the computed value.
fn - the re-mapping function: v - the old value or Nil, found - if there's an association of the key
func ComputeIfAbsent ¶
ComputeIfAbsent sets the computed value for the given key by a function when there's no association existing. Return the computed value and true if put, or the old value and false if the computation didn't happen.
fn - the function to compute the value
func MultiValuesTo ¶
func MultiValuesTo[K any, V any](src types.Map[K, types.Collection[V]], tgt types.Collection[V]) int
MultiValuesTo adds all values from a multi map to a target collection
func SliceFrom ¶
func SliceFrom[T any](col types.Collection[T]) []T
SliceFrom creates a new slice from the Collection,
len(slice) = min(size, elemCntFromIterator) cap(slice) = size
func SliceFromIt ¶
SliceFromIt creates a new slice from the Iterator,
func SliceProject ¶
func SliceProject[T any, R any](col types.Collection[T], fn func(t T) R) []R
SliceProject creates a new slice from the Collection and projects the elem by given mapping function.
len(slice) = min(size, elemCntFromIterator) cap(slice) = size
func SliceProjectIt ¶
SliceProjectIt creates a new slice from the Iterator and projects the elem by given mapping function.
func SortC ¶ added in v1.12.0
func SortC[T types.WithLess[T]](list types.IndexAccess[T])
SortC sorts the index based collection with elements implementing types.WithLess
func SortOrderable ¶ added in v1.5.0
func SortOrderable[T constraints.Ordered](list types.IndexAccess[T])
func StringFrom ¶
func StringFrom[T any](b types.Collection[T]) *string
func StringFromf ¶ added in v1.5.0
func StringFromf[T any](b types.Collection[T], toStringFn func(elem T) string) *string
func ValuesFromMulti ¶
Types ¶
This section is empty.