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

import java.util.Collection;
import java.util.stream.IntStream;

import net.ranides.assira.annotations.Meta;
import net.ranides.assira.collection.arrays.IntArrays;
import net.ranides.assira.collection.iterators.IntIterator;

/**
 * Specialization of Collection for integer types.
 * Avoids unecessary boxing and unboxing operations.
 *
 * @author Ranides Atterwim {@literal <ranides@gmail.com>}
 */
public interface IntCollection extends Collection<Integer> {

    /**
     * Empty collection
     */
    IntCollection EMPTY = IntArrays.asList();

    /**
     * non-generic version of {@link #add(Object)}
     * @param k k
     * @return bool
     */
    boolean add(int k);

    /**
     * non-generic version of {@link #addAll(Collection)}
     * @param values values
     * @return bool
     */
    boolean addAll(IntCollection values);

    /**
     * non-generic version of {@link #contains(Object)}
     * @param k k
     * @return bool
     */
    boolean contains(int k);

    /**
     * non-generic version of {@link #containsAll(Collection)}
     * @param values values
     * @return bool
     */
    boolean containsAll(IntCollection values);

    /**
     * non-generic version of {@link #iterator()}
     * @return IntIterator
     */
    @Override
    IntIterator iterator();

    /**
     * non-generic version of {@link #stream()}
     * @return IntStream
     */
    IntStream intstream();

    /**
     * non-generic version of {@link #remove(Object)}
     * @param k k
     * @return bool
     */
    boolean rem(int k);

    /**
     * alias for {@link #remove(Object)}
     * @param value value
     * @return bool
     */
    @Meta.Alias("remove")
    boolean rem(Object value);

    /**
     * non-generic version of {@link #removeAll(Collection)}
     * @param values values
     * @return bool
     */
    boolean removeAll(IntCollection values);

    /**
     * non-generic version of {@link #retainAll(Collection)}
     * @param values values
     * @return bool
     */
    boolean retainAll(IntCollection values);

    /**
     * alias for {@link #toIntArray(int[])}
     * @param a a
     * @return array
     */
    @Meta.Alias("toIntArray")
    int[] toArray(int[] a);

    /**
     * non-generic version of {@link #toArray()}
     * @return array
     */
    int[] toIntArray();

    /**
     * non-generic version of {@link #toArray(Object[])}
     * @param target target
     * @return array
     */
    int[] toIntArray(int[] target);
    
}
