SortedCache<T> class
Sorted cache is a cache manager for sorted data
Constructors
- SortedCache(int compare(T, T), bool unique)
- Creates a new instance of Sorted cache
Properties
-
buffer
↔ List<
T> -
Data will be stored here
getter/setter pair
- compare → int Function(T, T)
-
This function will be used to sort elements
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → int
-
Return the number of elements the buffer holds
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unique → bool
-
Enforce element uniqueness: replace existing element with a new one on conflict
final
Methods
-
deleteAt(
int at) → T - Remove element at the given position
-
deleteRange(
int since, int before) → void - Remove elements between two positions
-
find(
T element, bool nearest) → int - Find element in buffer using buffer's comparison function
-
findNearest(
T element, List< T> array, bool exact) → dynamic - Find nearest element index
-
forEach(
dynamic callback(T, int), int? startIndex, int? beforeIdx) → void -
Apply given function
callback
to all elements of the buffer -
getAt(
int at) → T - Get an element at the given position
-
getLast(
) → T - Convenience method for getting the last element of the buffer
-
insertSorted(
T element, List< T> array) → List<T> - Insert element into a sorted array
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
List< T> elements) → void - Add new elements to the buffer
-
reset(
) → void - Reset the buffer discarding all elements
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited