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

package it.unimi.dsi.fastutil.shorts;

import java.util.Iterator;
import java.util.Spliterator;
import java.util.stream.StreamSupport;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.function.IntPredicate;
import java.util.Objects;
import it.unimi.dsi.fastutil.SafeMath;
import java.util.function.Predicate;
import it.unimi.dsi.fastutil.ints.IntSpliterator;
import it.unimi.dsi.fastutil.Size64;
import it.unimi.dsi.fastutil.ints.IntIterator;
import java.util.Collection;

public interface ShortCollection extends Collection<Short>, ShortIterable
{
    ShortIterator iterator();
    
    default IntIterator intIterator() {
        return super.intIterator();
    }
    
    default ShortSpliterator spliterator() {
        return ShortSpliterators.asSpliterator(this.iterator(), Size64.sizeOf(this), 320);
    }
    
    default IntSpliterator intSpliterator() {
        return super.intSpliterator();
    }
    
    boolean add(final short p0);
    
    boolean contains(final short p0);
    
    boolean rem(final short p0);
    
    @Deprecated
    default boolean add(final Short key) {
        return this.add((short)key);
    }
    
    @Deprecated
    default boolean contains(final Object key) {
        return key != null && this.contains((short)key);
    }
    
    @Deprecated
    default boolean remove(final Object key) {
        return key != null && this.rem((short)key);
    }
    
    short[] toShortArray();
    
    @Deprecated
    default short[] toShortArray(final short[] a) {
        return this.toArray(a);
    }
    
    short[] toArray(final short[] p0);
    
    boolean addAll(final ShortCollection p0);
    
    boolean containsAll(final ShortCollection p0);
    
    boolean removeAll(final ShortCollection p0);
    
    @Deprecated
    default boolean removeIf(final Predicate<? super Short> filter) {
        return this.removeIf((filter instanceof ShortPredicate) ? ((ShortPredicate)filter) : (key -> filter.test(SafeMath.safeIntToShort(key))));
    }
    
    default boolean removeIf(final ShortPredicate filter) {
        Objects.requireNonNull(filter);
        boolean removed = false;
        final ShortIterator each = this.iterator();
        while (each.hasNext()) {
            if (filter.test(each.nextShort())) {
                each.remove();
                removed = true;
            }
        }
        return removed;
    }
    
    default boolean removeIf(final IntPredicate filter) {
        ShortPredicate filter2;
        if (filter instanceof ShortPredicate) {
            filter2 = (ShortPredicate)filter;
        }
        else {
            Objects.requireNonNull(filter);
            filter2 = filter::test;
        }
        return this.removeIf(filter2);
    }
    
    boolean retainAll(final ShortCollection p0);
    
    @Deprecated
    default Stream<Short> stream() {
        return super.stream();
    }
    
    default IntStream intStream() {
        return StreamSupport.intStream(this.intSpliterator(), false);
    }
    
    @Deprecated
    default Stream<Short> parallelStream() {
        return super.parallelStream();
    }
    
    default IntStream intParallelStream() {
        return StreamSupport.intStream(this.intSpliterator(), true);
    }
}
