@Test public void wheIterateTwoTimeArrayWithEvenNumbersThenResultSecondEvenNumber() { EvenIterator evenIt = new EvenIterator(new int[]{-1, 0, 1, 2}); evenIt.next(); int result = (Integer) evenIt.next(); assertThat(result, is(2)); }
@Override public Object next() { index++; return hasNext() ? nextEven() : null; }
EvenIterator implements Iterator { @Override public Object next() { index++; return hasNext() ? nextEven() : null; } }
EvenIterator implements Iterator { @Override public Object next() { index++; return hasNext() ? nextEven() : null; } EvenIterator(int[] values); }
EvenIterator implements Iterator { @Override public Object next() { index++; return hasNext() ? nextEven() : null; } EvenIterator(int[] values); @Override boolean hasNext(); @Override Object next(); }
EvenIterator implements Iterator { @Override public Object next() { index++; return hasNext() ? nextEven() : null; } EvenIterator(int[] values); @Override boolean hasNext(); @Override Object next();  }