mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-18 05:42:09 +01:00
fn: add set copy method Copy
This commit is contained in:
parent
8ecef03315
commit
6fb8269c84
@ -95,6 +95,15 @@ func (s Set[T]) ToSlice() []T {
|
||||
return maps.Keys(s)
|
||||
}
|
||||
|
||||
// Copy copies s and returns the result.
|
||||
func (s Set[T]) Copy() Set[T] {
|
||||
copy := make(Set[T])
|
||||
for e := range s {
|
||||
copy.Add(e)
|
||||
}
|
||||
return copy
|
||||
}
|
||||
|
||||
// SetDiff returns all the items that are in the first set but not in the
|
||||
// second.
|
||||
func SetDiff[T comparable](a, b []T) []T {
|
||||
|
Loading…
x
Reference in New Issue
Block a user