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

package it.unimi.dsi.fastutil.shorts;

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

public interface ShortIterator extends PrimitiveIterator<Short, ShortConsumer>
{
    short nextShort();
    
    @Deprecated
    default Short next() {
        return this.nextShort();
    }
    
    default void forEachRemaining(final ShortConsumer action) {
        Objects.requireNonNull(action);
        while (this.hasNext()) {
            action.accept(this.nextShort());
        }
    }
    
    default void forEachRemaining(final IntConsumer action) {
        Objects.requireNonNull(action);
        ShortConsumer action2;
        if (action instanceof ShortConsumer) {
            action2 = (ShortConsumer)action;
        }
        else {
            Objects.requireNonNull(action);
            action2 = action::accept;
        }
        this.forEachRemaining(action2);
    }
    
    @Deprecated
    default void forEachRemaining(final Consumer<? super Short> action) {
        ShortConsumer action2;
        if (action instanceof ShortConsumer) {
            action2 = (ShortConsumer)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.nextShort();
        }
        return n - i - 1;
    }
}
