@Test public void testAdd() { RingBufferList<Integer> rl = new RingBufferList<Integer>(4); assertEquals(0, rl.size()); rl.add(0); assertEquals(1, rl.size()); assertEquals(0, (int) rl.get(0)); rl.add(1); assertEquals(2, rl.size()); assertEquals(1, (int) rl.get(1)); rl.add(2); assertEquals(3, rl.size()); assertEquals(2, (int) rl.get(2)); rl.set(1, 5); assertEquals(3, rl.size()); assertEquals(5, (int) rl.get(1)); rl.add(3); assertEquals(4, rl.size()); assertEquals(3, (int) rl.get(3)); rl.add(4); assertEquals(4, rl.size()); assertEquals(4, (int) rl.get(3)); rl.add(5); assertEquals(4, rl.size()); assertEquals(5, (int) rl.get(3)); }
public boolean add(A a) { if (end >= 0) { end++; if (end >= values.length) { end = 0; } if (end == start) { start++; } if (start >= values.length) { start = 0; } } else { start = 0; end = 0; } values[end] = a; return true; }
RingBufferList implements List<A>, Serializable { public boolean add(A a) { if (end >= 0) { end++; if (end >= values.length) { end = 0; } if (end == start) { start++; } if (start >= values.length) { start = 0; } } else { start = 0; end = 0; } values[end] = a; return true; } }
RingBufferList implements List<A>, Serializable { public boolean add(A a) { if (end >= 0) { end++; if (end >= values.length) { end = 0; } if (end == start) { start++; } if (start >= values.length) { start = 0; } } else { start = 0; end = 0; } values[end] = a; return true; } RingBufferList();  RingBufferList(int maximumSize); }
RingBufferList implements List<A>, Serializable { public boolean add(A a) { if (end >= 0) { end++; if (end >= values.length) { end = 0; } if (end == start) { start++; } if (start >= values.length) { start = 0; } } else { start = 0; end = 0; } values[end] = a; return true; } RingBufferList();  RingBufferList(int maximumSize); int maxSize(); boolean add(A a); int size(); String toString(); void addFirst(A a); @SuppressWarnings("unchecked") A get(int index); @SuppressWarnings("unchecked") A set(int index, A a); void clear(); void add(int index, A element); boolean addAll(Collection<? extends A> c); boolean addAll(int index, Collection<? extends A> c); boolean contains(Object o); boolean containsAll(Collection<?> c); int indexOf(Object o); boolean isEmpty(); Iterator<A> iterator(); int lastIndexOf(Object o); ListIterator<A> listIterator(); ListIterator<A> listIterator(int index); boolean remove(Object o); A remove(int index); boolean removeAll(Collection<?> c); boolean retainAll(Collection<?> c); List<A> subList(int fromIndex, int toIndex); Object[] toArray(); T[] toArray(T[] a); }
RingBufferList implements List<A>, Serializable { public boolean add(A a) { if (end >= 0) { end++; if (end >= values.length) { end = 0; } if (end == start) { start++; } if (start >= values.length) { start = 0; } } else { start = 0; end = 0; } values[end] = a; return true; } RingBufferList();  RingBufferList(int maximumSize); int maxSize(); boolean add(A a); int size(); String toString(); void addFirst(A a); @SuppressWarnings("unchecked") A get(int index); @SuppressWarnings("unchecked") A set(int index, A a); void clear(); void add(int index, A element); boolean addAll(Collection<? extends A> c); boolean addAll(int index, Collection<? extends A> c); boolean contains(Object o); boolean containsAll(Collection<?> c); int indexOf(Object o); boolean isEmpty(); Iterator<A> iterator(); int lastIndexOf(Object o); ListIterator<A> listIterator(); ListIterator<A> listIterator(int index); boolean remove(Object o); A remove(int index); boolean removeAll(Collection<?> c); boolean retainAll(Collection<?> c); List<A> subList(int fromIndex, int toIndex); Object[] toArray(); T[] toArray(T[] a);  }