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

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

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

import com.annimon.stream.function.IndexedFunction;
import com.annimon.stream.iterator.IndexedIterator;
import com.annimon.stream.iterator.LsaIterator;

public class ObjMapIndexed extends LsaIterator {

    private final IndexedIterator iterator;
    private final IndexedFunction mapper;

    public ObjMapIndexed(IndexedIterator iterator, IndexedFunction mapper) {
        this.iterator = iterator;
        this.mapper = mapper;
    }

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

    @Override
    public R nextIteration() {
        return mapper.apply(iterator.getIndex(), iterator.next());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy