Home

# Class goog.structs.CircularBuffer

Class for CircularBuffer.

Instance Method Summary
| `add(<Any Type> item)` Adds an item to the buffer. May remove the oldest item if the buffer is at max size.
| `clear()` Empties the current buffer.
| `containsKey(number key) ⇒ boolean` Whether the buffer contains the key/index.
| `containsValue(<Any Type> value) ⇒ boolean` Whether the buffer contains the given value.
| `get(number index) ⇒ <Any Type>` Returns the item at the specified index.
| `getCount() ⇒ number` Returns the current number of items in the buffer.
| `getKeys() ⇒ ?Array`
| `getLast() ⇒ <Any Type>` Returns the last item inserted into the buffer.
| `getNewestValues(number maxCount) ⇒ ?Array` Returns the newest values in the buffer up to {@code count}.
| `getValues() ⇒ ?Array`
| `isEmpty() ⇒ boolean`
| `normalizeIndex_(number index) ⇒ number` Helper function to convert an index in the number space of oldest to newest items in the array to the position that the element will be at in the underlying array.
| `set(number index, <Any Type> item)` Sets the item at the specified index.