1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-17 16:12:42 +08:00
Files
go-mixed/collections/list/list.go
2023-08-25 15:31:00 +08:00

36 lines
552 B
Go

package list
import (
"errors"
"github.com/charlienet/go-mixed/locker"
)
var ErrorOutOffRange = errors.New("out of range")
type List[T any] interface {
}
type list[T any] struct {
size int
mu locker.WithRWLocker
}
func (l *list[T]) Synchronize() {
l.mu.Synchronize()
}
func (l *list[T]) ForEach(fn func(T) bool) { panic("Not Implemented") }
func (l *LinkedList[T]) ToSlice() []T {
s := make([]T, 0, l.Size())
l.ForEach(func(t T) bool {
s = append(s, t)
return false
})
return s
}
func (l *list[T]) Size() int { return l.size }