github.com/songzhibin97/go-baseutils@v0.0.2-0.20240302024150-487d8ce9c082/structure/lists/list.go (about)

     1  package lists
     2  
     3  import (
     4  	"github.com/songzhibin97/go-baseutils/base/bcomparator"
     5  	"github.com/songzhibin97/go-baseutils/structure/containers"
     6  )
     7  
     8  // List interface that all lists implement
     9  type List[E any] interface {
    10  	Get(index int) (E, bool)
    11  	Remove(index int)
    12  	Add(values ...E)
    13  	Contains(values ...E) bool
    14  	Sort(comparator bcomparator.Comparator[E])
    15  	Swap(index1, index2 int)
    16  	Insert(index int, values ...E)
    17  	Set(index int, value E)
    18  
    19  	containers.Container[E]
    20  	// Empty() bool
    21  	// Size() int
    22  	// Clear()
    23  	// Values() []E
    24  	// String() string
    25  }