Class RingBuffer<T>

java.lang.Object
com.renomad.minum.utils.RingBuffer<T>
All Implemented Interfaces:
Iterable<T>

public class RingBuffer<T> extends Object implements Iterable<T>
  • Constructor Details

    • RingBuffer

      public RingBuffer(int limit, Class<T> clazz)
      Build a RingBuffer
      Parameters:
      limit - the maximum size of the buffer
  • Method Details

    • add

      public void add(T item)
    • getLimit

      public int getLimit()
    • contains

      public boolean contains(List<T> myList)
      Returns true if the data in the "myList" parameter is found within the RingBuffer.
    • containsAt

      public boolean containsAt(List<T> myList, int index)
      Returns true if the data in the "myList" parameter is found within the RingBuffer at the index provided.
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • atNextIndex

      public T atNextIndex()
      Returns the value at the slot pointed to by the "nextIndex". Note that this will be null at first while the array starts to get filled.