All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jnape.palatable.lambda.internal.iteration.MappingIterator Maven / Gradle / Ivy

There is a newer version: 5.5.0
Show newest version
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 function;
    private final Iterator                 iterator;

    public MappingIterator(Fn1 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