Class 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 Detail

      • CircularBuffer

        public CircularBuffer​(int capacity)
    • Method Detail

      • 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()