Class CircularBuffer<E>

java.lang.Object
org.apache.druid.utils.CircularBuffer<E>
Type Parameters:
E - Type of object to be stored in the buffer

public class CircularBuffer<E> extends Object
A circular buffer that supports random bidirectional access.
  • Constructor Details

    • CircularBuffer

      public CircularBuffer(int capacity)
  • Method Details

    • getBuffer

      public E[] getBuffer()
    • add

      public void add(E item)
    • getLatest

      public E getLatest(int index)
      Access object at a given index, starting from the latest entry added and moving backwards.
    • get

      public E get(int index)
      Access object at a given index, starting from the earliest entry added and moving forward.
    • size

      public int size()