mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 11:11:47 +02:00
Convenience method to access any member of a set
This commit is contained in:
@@ -73,6 +73,13 @@ func (self *Set[T]) Iterable() map[T]struct{} {
|
|||||||
return self.items
|
return self.items
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *Set[T]) Any() T {
|
||||||
|
for x := range self.items {
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
panic("set is empty")
|
||||||
|
}
|
||||||
|
|
||||||
func (self *Set[T]) AsSlice() []T {
|
func (self *Set[T]) AsSlice() []T {
|
||||||
return Keys(self.items)
|
return Keys(self.items)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user