Documentation ¶
Index ¶
- func MakeFilledMap[T any](size int, defaultValue T) map[int]T
- func MultiplyArray[T Number](numbers []T) T
- func ProcessFile[T any](path string, textHandler textHandler[T]) []T
- func ReadFile(path string) []string
- func RemoveEmptyStrings(strings []string) []string
- func SumArray[T Number](numbers []T) T
- func SumMapValues[TKey comparable, TValue Number](mapToSum map[TKey]TValue) TValue
- func WriteToFile(path string, content string)
- type FilterFunc
- type Number
- type Set
- func (s *Set[T]) Add(v T)
- func (s *Set[T]) AddMulti(list ...T)
- func (s *Set[T]) Clear()
- func (s *Set[T]) Difference(s2 *Set[T]) *Set[T]
- func (s *Set[T]) Filter(P FilterFunc[T]) *Set[T]
- func (s *Set[T]) Has(v T) bool
- func (s *Set[T]) Intersect(s2 *Set[T]) *Set[T]
- func (s *Set[T]) Remove(v T)
- func (s *Set[T]) Size() int
- func (s *Set[T]) Union(s2 *Set[T]) *Set[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeFilledMap ¶
func MultiplyArray ¶
func MultiplyArray[T Number](numbers []T) T
func ProcessFile ¶
func RemoveEmptyStrings ¶
func SumMapValues ¶
func SumMapValues[TKey comparable, TValue Number](mapToSum map[TKey]TValue) TValue
func WriteToFile ¶
Types ¶
type FilterFunc ¶
type FilterFunc[T comparable] func(v T) bool
type Number ¶
type Number interface { constraints.Integer | constraints.Float }
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func NewSet ¶
func NewSet[T comparable]() *Set[T]
func (*Set[T]) AddMulti ¶
func (s *Set[T]) AddMulti(list ...T)
AddMulti Add multiple values in the set
func (*Set[T]) Difference ¶
Difference returns the subset from s, that doesn't exists in s2 (param)
func (*Set[T]) Filter ¶
func (s *Set[T]) Filter(P FilterFunc[T]) *Set[T]
Filter returns a subset, that contains only the values that satisfies the given predicate P
Click to show internal directories.
Click to hide internal directories.