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

com.annimon.stream.operator.ObjMapToInt Maven / Gradle / Ivy

package com.annimon.stream.operator;

import com.annimon.stream.function.ToIntFunction;
import com.annimon.stream.iterator.PrimitiveIterator;
import java.util.Iterator;

public class ObjMapToInt extends PrimitiveIterator.OfInt {

    private final Iterator iterator;
    private final ToIntFunction mapper;

    public ObjMapToInt(Iterator iterator, ToIntFunction mapper) {
        this.iterator = iterator;
        this.mapper = mapper;
    }

    @Override
    public boolean hasNext() {
        return iterator.hasNext();
    }

    @Override
    public int nextInt() {
        return mapper.applyAsInt(iterator.next());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy