@Test public void add() { @SuppressWarnings("unchecked") IndexedRingBuffer<LSubscription> list = IndexedRingBuffer.getInstance(); list.add(new LSubscription(1)); list.add(new LSubscription(2)); final AtomicInteger c = new AtomicInteger(); list.forEach(newCounterAction(c)); assertEquals(2, c.get()); }
public int add(E e) { int i = getIndexForAdd(); if (i < SIZE) { elements.array.set(i, e); return i; } else { int sectionIndex = i % SIZE; getElementSection(i).array.set(sectionIndex, e); return i; } }
IndexedRingBuffer implements Subscription { public int add(E e) { int i = getIndexForAdd(); if (i < SIZE) { elements.array.set(i, e); return i; } else { int sectionIndex = i % SIZE; getElementSection(i).array.set(sectionIndex, e); return i; } } }
IndexedRingBuffer implements Subscription { public int add(E e) { int i = getIndexForAdd(); if (i < SIZE) { elements.array.set(i, e); return i; } else { int sectionIndex = i % SIZE; getElementSection(i).array.set(sectionIndex, e); return i; } } private  IndexedRingBuffer(); }
IndexedRingBuffer implements Subscription { public int add(E e) { int i = getIndexForAdd(); if (i < SIZE) { elements.array.set(i, e); return i; } else { int sectionIndex = i % SIZE; getElementSection(i).array.set(sectionIndex, e); return i; } } private  IndexedRingBuffer(); final static IndexedRingBuffer getInstance(); void releaseToPool(); @Override void unsubscribe(); int add(E e); E remove(int index); @Override boolean isUnsubscribed(); int forEach(Func1<? super E, Boolean> action); int forEach(Func1<? super E, Boolean> action, int startIndex); }
IndexedRingBuffer implements Subscription { public int add(E e) { int i = getIndexForAdd(); if (i < SIZE) { elements.array.set(i, e); return i; } else { int sectionIndex = i % SIZE; getElementSection(i).array.set(sectionIndex, e); return i; } } private  IndexedRingBuffer(); final static IndexedRingBuffer getInstance(); void releaseToPool(); @Override void unsubscribe(); int add(E e); E remove(int index); @Override boolean isUnsubscribed(); int forEach(Func1<? super E, Boolean> action); int forEach(Func1<? super E, Boolean> action, int startIndex);  }