@Test public void shouldMapTheValuesOfTheDelegateIteratorUsingTheSuppliedMapFunction() { Iterator<Integer> delegateIterator = iterableWith(1, 2, 3).iterator(); MappedIterator<Integer, String> iterator = new MappedIterator<Integer, String>( delegateIterator, stringValueMapFunction()); assertThat(iterator.next(), is("1")); assertThat(iterator.next(), is("2")); assertThat(iterator.next(), is("3")); }
public T next() { return function.call(iterator.next()); }
MappedIterator implements Iterator<T> { public T next() { return function.call(iterator.next()); } }
MappedIterator implements Iterator<T> { public T next() { return function.call(iterator.next()); } MappedIterator(Iterator<? extends S> iterator, UnaryFunction<? super S, ? extends T> mapper); }
MappedIterator implements Iterator<T> { public T next() { return function.call(iterator.next()); } MappedIterator(Iterator<? extends S> iterator, UnaryFunction<? super S, ? extends T> mapper); boolean hasNext(); T next(); void remove(); @Override String toString(); }
MappedIterator implements Iterator<T> { public T next() { return function.call(iterator.next()); } MappedIterator(Iterator<? extends S> iterator, UnaryFunction<? super S, ? extends T> mapper); boolean hasNext(); T next(); void remove(); @Override String toString();  }