38 lines
566 B
Go
38 lines
566 B
Go
package ds
|
|
|
|
type Addable[T any] interface {
|
|
Add(value T)
|
|
AddAll(values Iterable[T])
|
|
}
|
|
|
|
type Retrievable[T comparable] interface {
|
|
Has(value T) bool
|
|
}
|
|
|
|
type Indexable[K comparable, T any] interface {
|
|
Get(index K) T
|
|
Set(index K, value T)
|
|
}
|
|
|
|
type IndexedRemovable[K comparable, T any] interface {
|
|
RemoveAt(index K) T
|
|
}
|
|
|
|
type ComparingRemovable[T any] interface {
|
|
Remove(value T)
|
|
RemoveAll(values Iterable[T])
|
|
}
|
|
|
|
type Clearable interface {
|
|
Clear()
|
|
}
|
|
|
|
type Sized interface {
|
|
Size() int
|
|
Empty() bool
|
|
}
|
|
|
|
type Iterable[T any] interface {
|
|
Each(f func(value T))
|
|
}
|