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

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

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

import com.annimon.stream.function.LongConsumer;
import com.annimon.stream.iterator.PrimitiveIterator;

public class LongPeek extends PrimitiveIterator.OfLong {

    private final PrimitiveIterator.OfLong iterator;
    private final LongConsumer action;

    public LongPeek(PrimitiveIterator.OfLong iterator, LongConsumer action) {
        this.iterator = iterator;
        this.action = action;
    }

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

    @Override
    public long nextLong() {
        final long value = iterator.nextLong();
        action.accept(value);
        return value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy