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

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

There is a newer version: 1.2.2
Show newest version
package com.annimon.stream.operator;

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

public class ObjMapToLong extends PrimitiveIterator.OfLong {

    private final Iterator iterator;
    private final ToLongFunction mapper;

    public ObjMapToLong(Iterator iterator, ToLongFunction mapper) {
        this.iterator = iterator;
        this.mapper = mapper;
    }

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

    @Override
    public long nextLong() {
        return mapper.applyAsLong(iterator.next());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy