@Test public void hasNext_ReturnsFalseWithEmptyList() { PeekIterator<Integer> tested = new PeekIterator<Integer>( emptyList.iterator()); assertFalse(tested.hasNext()); }
@Override public boolean hasNext() { if (nextitem != null) { return true; } if (iterator.hasNext()) { nextitem = iterator.next(); } return nextitem != null; }
PeekIterator implements Iterator<T> { @Override public boolean hasNext() { if (nextitem != null) { return true; } if (iterator.hasNext()) { nextitem = iterator.next(); } return nextitem != null; } }
PeekIterator implements Iterator<T> { @Override public boolean hasNext() { if (nextitem != null) { return true; } if (iterator.hasNext()) { nextitem = iterator.next(); } return nextitem != null; } PeekIterator(Iterator<T> iterator); }
PeekIterator implements Iterator<T> { @Override public boolean hasNext() { if (nextitem != null) { return true; } if (iterator.hasNext()) { nextitem = iterator.next(); } return nextitem != null; } PeekIterator(Iterator<T> iterator); @Override boolean hasNext(); @Override T next(); T peek(); @Override void remove(); }
PeekIterator implements Iterator<T> { @Override public boolean hasNext() { if (nextitem != null) { return true; } if (iterator.hasNext()) { nextitem = iterator.next(); } return nextitem != null; } PeekIterator(Iterator<T> iterator); @Override boolean hasNext(); @Override T next(); T peek(); @Override void remove();  }