RingBufferUtils<T extends Object> class
Fixed-capacity ring buffer. When full, oldest is overwritten.
Constructors
- RingBufferUtils(int capacity)
-
Creates a ring buffer holding at most
capacityelements. Throws an ArgumentError ifcapacityis less than 1.factory
Properties
- capacity → int
-
Maximum number of elements; when full, oldest is overwritten.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
True when the buffer has no elements.
no setter
- isNotEmpty → bool
-
True when the buffer has at least one element.
no setter
- length → int
-
Current number of elements (0 to capacity).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
T value) → void -
Appends
value; overwrites oldest if at capacity. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeFirst(
) → T? - Removes and returns the oldest element, or null when the buffer is empty.
-
toList(
) → List< T> - Elements in order (oldest first).
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited