com.jnape.palatable.lambda.internal.iteration.MappingIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lambda Show documentation
Show all versions of lambda Show documentation
Functional patterns for Java
package com.jnape.palatable.lambda.internal.iteration;
import com.jnape.palatable.lambda.functions.Fn1;
import java.util.Iterator;
public final class MappingIterator extends ImmutableIterator {
private final Fn1 super A, ? extends B> function;
private final Iterator iterator;
public MappingIterator(Fn1 super A, ? extends B> function, Iterator iterator) {
this.function = function;
this.iterator = iterator;
}
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public B next() {
return function.apply(iterator.next());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy