Documentation
¶
Index ¶
- type LazySortedList
- func (l *LazySortedList[T]) Add(items ...T)
- func (l *LazySortedList[T]) Clear()
- func (l *LazySortedList[T]) Get(index int) (T, bool)
- func (l *LazySortedList[T]) GetRange(start, end int) ([]T, bool)
- func (l *LazySortedList[T]) InnerItems() []T
- func (l *LazySortedList[T]) InnerLen() int
- func (l *LazySortedList[T]) Items() []T
- func (l *LazySortedList[T]) Len() int
- func (l *LazySortedList[T]) MustGet(index int) T
- func (l *LazySortedList[T]) Sort(less func(a, b T) int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LazySortedList ¶
type LazySortedList[T any] struct { // contains filtered or unexported fields }
LazySortedList maintains a list that can be lazily sorted with a custom comparator
func NewLazySortedList ¶
func NewLazySortedList[T any]() *LazySortedList[T]
NewLazySortedList creates a new LazySortedList
func (*LazySortedList[T]) Add ¶
func (l *LazySortedList[T]) Add(items ...T)
Add appends an item to the list and marks it as needing sorting
func (*LazySortedList[T]) Get ¶
func (l *LazySortedList[T]) Get(index int) (T, bool)
Get returns the item at the given index
func (*LazySortedList[T]) GetRange ¶
func (l *LazySortedList[T]) GetRange(start, end int) ([]T, bool)
GetRange returns a slice of items in the given range
func (*LazySortedList[T]) InnerItems ¶
func (l *LazySortedList[T]) InnerItems() []T
InnerItems returns the current inner items in the list
func (*LazySortedList[T]) InnerLen ¶
func (l *LazySortedList[T]) InnerLen() int
InnerLen returns the current inner length of the list, which is the length considering unsorted items
func (*LazySortedList[T]) Items ¶
func (l *LazySortedList[T]) Items() []T
Items returns the current items in the list
func (*LazySortedList[T]) Len ¶
func (l *LazySortedList[T]) Len() int
Len returns the current length of the list
func (*LazySortedList[T]) MustGet ¶
func (l *LazySortedList[T]) MustGet(index int) T
MustGet returns the item at the given index
func (*LazySortedList[T]) Sort ¶
func (l *LazySortedList[T]) Sort(less func(a, b T) int)
Sort sorts the list using the provided less function if needed