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)
| 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. |
| 105 | func (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. |
| 114 | func (set Set[T]) Equals(sset Set[T]) bool { |