// 
// Decompiled by Procyon v0.6.0
// 

package it.unimi.dsi.fastutil.bytes;

import java.util.function.Consumer;
import java.util.function.IntConsumer;
import java.util.Objects;
import java.util.PrimitiveIterator;

public interface ByteIterator extends PrimitiveIterator<Byte, ByteConsumer>
{
    byte nextByte();
    
    @Deprecated
    default Byte next() {
        return this.nextByte();
    }
    
    default void forEachRemaining(final ByteConsumer action) {
        Objects.requireNonNull(action);
        while (this.hasNext()) {
            action.accept(this.nextByte());
        }
    }
    
    default void forEachRemaining(final IntConsumer action) {
        Objects.requireNonNull(action);
        ByteConsumer action2;
        if (action instanceof ByteConsumer) {
            action2 = (ByteConsumer)action;
        }
        else {
            Objects.requireNonNull(action);
            action2 = action::accept;
        }
        this.forEachRemaining(action2);
    }
    
    @Deprecated
    default void forEachRemaining(final Consumer<? super Byte> action) {
        ByteConsumer action2;
        if (action instanceof ByteConsumer) {
            action2 = (ByteConsumer)action;
        }
        else {
            Objects.requireNonNull(action);
            action2 = action::accept;
        }
        this.forEachRemaining(action2);
    }
    
    default int skip(final int n) {
        if (n < 0) {
            throw new IllegalArgumentException("Argument must be nonnegative: " + n);
        }
        int i = n;
        while (i-- != 0 && this.hasNext()) {
            this.nextByte();
        }
        return n - i - 1;
    }
}
