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

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

The newest version!
package com.annimon.stream.operator;

import com.landawn.abacus.util.function.LongToIntFunction;
import com.annimon.stream.iterator.PrimitiveIterator;

public class LongMapToInt extends PrimitiveIterator.OfInt {

    private final PrimitiveIterator.OfLong iterator;
    private final LongToIntFunction mapper;

    public LongMapToInt(PrimitiveIterator.OfLong iterator, LongToIntFunction mapper) {
        this.iterator = iterator;
        this.mapper = mapper;
    }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy