@Test public void test() { assertEquals("woot", sut.getNext()); assertEquals("it", sut.getNext()); assertEquals("works", sut.getNext()); assertEquals("woot", sut.getNext()); assertEquals("it", sut.getNext()); assertEquals("works", sut.getNext()); assertEquals("woot", sut.getNext()); assertEquals("it", sut.getNext()); assertEquals("works", sut.getNext()); }
@Override public T getNext() { synchronized (lock) { T result = items.get(index); index = ++index == size ? 0 : index; return result; } }
RoundRobinRotator implements Rotator<T> { @Override public T getNext() { synchronized (lock) { T result = items.get(index); index = ++index == size ? 0 : index; return result; } } }
RoundRobinRotator implements Rotator<T> { @Override public T getNext() { synchronized (lock) { T result = items.get(index); index = ++index == size ? 0 : index; return result; } } RoundRobinRotator(final List<T> inItems); }
RoundRobinRotator implements Rotator<T> { @Override public T getNext() { synchronized (lock) { T result = items.get(index); index = ++index == size ? 0 : index; return result; } } RoundRobinRotator(final List<T> inItems); @Override T getNext(); }
RoundRobinRotator implements Rotator<T> { @Override public T getNext() { synchronized (lock) { T result = items.get(index); index = ++index == size ? 0 : index; return result; } } RoundRobinRotator(final List<T> inItems); @Override T getNext();  }