IndexAwareCircularBuffer<T extends IndexedItem> class

A circular buffer in which elements know their index in the buffer.

Constructors

IndexAwareCircularBuffer.new(int maxLength)
Creates a new circular list with the specified maxLength.

Properties

hashCode int
The hash code for this object.
no setterinherited
isFull bool
Whether adding another element would cause the first element to be trimmed.
no setter
length int
Number of elements in the list.
no setter
maxLength int
The number of elements that can be stored in the list.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Removes all elements from the list.
debugDump() String
UncompleteDocumentation
forEach(void callback(T item)) → void
Iterates over the list and calls callback for each element.
insert(int index, T item) → void
Inserts item at index, shifting all elements after index to the right. May cause the first element to be trimmed if the list is full.
insertAll(int index, List<T> items) → void
Inserts items at index in order.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pop() → T
Removes and returns the last value on the list, throws if the list is empty.
push(T value) → void
Adds value to the end of the list. May cause the first element to be trimmed if the list is full.
pushAll(Iterable<T> items) → void
Adds all elements in items to the list.
remove(int index, [int count = 1]) → void
Deletes count elements starting at index, shifting all elements after index to the left.
replaceWith(List<T> replacement) → void
Replaces all elements in the list with replacement.
swap(int index, T value) → T
Replaces the element at index with value and returns the replaced item.
toList() List<T>
Returns a list containing all elements in the list.
toString() String
A string representation of this object.
inherited
trimStart(int count) → void
Removes count elements starting at index, shifting all elements after index to the left.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) → T
Gets the element at the specified index in the list. Throws if the index is out of bounds.
operator []=(int index, T value) → void
Sets the element at the specified index in the list. Throws if the index is out of bounds.