Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ArrayListCapacity int = 100
)
Functions ¶
This section is empty.
Types ¶
type Filterfunc ¶ added in v0.1.9
type IBaseList ¶ added in v0.1.9
type IBaseList[deepCopy IDeepCopy[T], T any] interface { // Add adds data to the end of the list Add(data deepCopy) (resultIndex int) // Remove removes data from the list and returns error if the data is not found Remove(data deepCopy) (removedIndex int, err error) // RemoveAtIndex removes data at the index, if the index is not valid then returns error RemoveAtIndex(index int) (data deepCopy, err error) // Count return the count of elements in the list Count() int // Get gets data at the index, if index is not valid then it returns error Get(index int) (data deepCopy, err error) // Set updates the data at the index, if index is not valid then returns error Set(index int, data deepCopy) error // Find helps to get the first occourance if the data that matches the input and returns index // if index is -1 then the data is not found Find(data deepCopy) (index int) // RemoveAll function removes al elements for which the f returns true, // this also returns all elements removed RemoveAll(f Filterfunc[deepCopy, T]) []deepCopy }
type IIndexedItratorList ¶
type IIndexedItratorList[deepCopy IDeepCopy[T], T any] interface { IItratorList[deepCopy, T] // FindByIndexedKey get the first occourance if the data that matches according to the filter func and also returns index, // this helps in fast search ad it will do a binary search on the indexKey // this is similar to Non-Clustered Index in database FindByIndexedKey(indexKey string, key string) (data T, index int) // FindByIndexedKey get the first occourance if the data that matches according to the filter func and also returns index, // this helps in fast search ad it will do a binary search on the indexKey // this is similar to Non-Clustered Index in database FilterByIndexedKey(indexKey string, key string) []T }
type IItratorList ¶
type IItratorList[deepCopy IDeepCopy[T], T any] interface { IList[deepCopy, T] // Filter helps to get the all data that matches according to the filter func and also returns index Filter(f Filterfunc[deepCopy, T]) []deepCopy // DeepCopy this is used to create a copy of the list DeepCopy() []deepCopy }
func InitArrayList ¶ added in v0.1.7
func InitArrayList[deepCopy IDeepCopy[T], T any](data ...deepCopy) IItratorList[deepCopy, T]
type IList ¶
type IList[deepCopy IDeepCopy[T], T any] interface { IBaseList[deepCopy, T] // AddAtIndex adds data to the index in the list and shifts all data to right // if the index is out of bound then return error AddAtIndex(index int, data deepCopy) (err error) }
func InitSingleLinkedList ¶
type ISortedItratorList ¶ added in v0.1.8
type ISortedItratorList[deepCopy IDeepCopy[T], T any] interface { IBaseList[deepCopy, T] // Filter helps to get the all data that matches according to the filter func and also returns index Filter(f Filterfunc[deepCopy, T]) []deepCopy // DeepCopy this is used to create a copy of the list DeepCopy() []deepCopy }
func InitSortedList ¶ added in v0.1.8
func InitSortedList[deepCopy IDeepCopy[T], T any](lessFn Less[deepCopy, T]) ISortedItratorList[deepCopy, T]
Click to show internal directories.
Click to hide internal directories.