gods/lists/main.go
2023-10-24 00:49:26 +03:00

34 lines
688 B
Go

package lists
import (
"github.com/reklesio/gods"
)
// The interface all the lists must implement.
type List[V any] interface {
gods.Container[V]
Push(...V)
// Get length of the list
Len() int
// Get the value by index.
Get(int) V
// Delete the value by index.
Del(int)
// Change already existing value.
Set(int, V)
// Add the values
Add(...V)
// Insert the value before the specifed index.
InsB(V, int)
// Insert the value after the specified index.
InsA(int, V)
// Swap elements by indexes specified in arguments.
Swap(i, j int)
// The sort function that gets the Less function as argument
// and sorts the list corresponding to it.
Sort(gods.LessFunc[V])
}