MCPcopy
hub / github.com/minio/minio-go / ApplyFunc

Method ApplyFunc

pkg/set/set.go:105–111  ·  view source on GitHub ↗

ApplyFunc - returns new set containing each value processed by 'applyFn'. A 'applyFn' should accept element in a set as an argument and return a processed value. The function can do any logic to return a processed value.

(applyFn func(T) T)

Source from the content-addressed store, hash-verified

103// A 'applyFn' should accept element in a set as an argument and return
104// a processed value. The function can do any logic to return a processed value.
105func (set Set[T]) ApplyFunc(applyFn func(T) T) Set[T] {
106 nset := New[T]()
107 for k := range set {
108 nset.Add(applyFn(k))
109 }
110 return nset
111}
112
113// Equals - checks whether given set is equal to current set or not.
114func (set Set[T]) Equals(sset Set[T]) bool {

Callers 3

TestIntSetApplyFuncFunction · 0.45
TestStringSetApplyFuncFunction · 0.45
ExampleSet_ApplyFuncFunction · 0.45

Calls 1

AddMethod · 0.45

Tested by 3

TestIntSetApplyFuncFunction · 0.36
TestStringSetApplyFuncFunction · 0.36
ExampleSet_ApplyFuncFunction · 0.36