/*
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.collection.iterators;

import java.util.ListIterator;

/**
 * Interface identical to generic ListIterator, but avoiding boxing operations.
 * It provides default implementations of methods required by {@code ListIterator<Integer>}
 *
 * IntInterator can be used as ordinary iterator, but it offers methods for working with primitive values.
 *
 *
 */
public interface IntListIterator extends IntIterator, ListIterator<Integer> {

    @Override
    default void remove() {
        IntIterator.super.remove();
    }
    
    @Override
    default Integer next() {
        return IntIterator.super.next();
    }

    /**
     * non-generic version of {@link #set(Integer)}
     * @param value value
     */
    default void set(int value) {
        throw new UnsupportedOperationException();
    }
    
    @Override
    default void set(Integer value) {
        set(value.intValue());
    }

    /**
     * non-generic version of {@link #add(Integer)}
     * @param value value
     */
    default void add(int value) {
        throw new UnsupportedOperationException();
    }
    
    @Override
    default void add(Integer value) {
        add(value.intValue());
    }

    /**
     * non-generic version of {@link #previous()}
     * @return int
     */
    int previousInt();

    @Override
    default Integer previous() {
        return previousInt();
    }
}
