utils

package
v0.0.0-...-557c218 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

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]) Clear

func (l *LazySortedList[T]) Clear()

Clear empties the list

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL