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

package it.unimi.dsi.fastutil.bytes;

import java.util.Iterator;
import java.util.Spliterator;
import java.util.Collection;
import it.unimi.dsi.fastutil.Size64;
import java.util.Set;

public interface ByteSet extends ByteCollection, Set<Byte>
{
    ByteIterator iterator();
    
    default ByteSpliterator spliterator() {
        return ByteSpliterators.asSpliterator(this.iterator(), Size64.sizeOf(this), 321);
    }
    
    boolean remove(final byte p0);
    
    @Deprecated
    default boolean remove(final Object o) {
        return super.remove(o);
    }
    
    @Deprecated
    default boolean add(final Byte o) {
        return super.add(o);
    }
    
    @Deprecated
    default boolean contains(final Object o) {
        return super.contains(o);
    }
    
    @Deprecated
    default boolean rem(final byte k) {
        return this.remove(k);
    }
    
    default ByteSet of() {
        return ByteSets.UNMODIFIABLE_EMPTY_SET;
    }
    
    default ByteSet of(final byte e) {
        return ByteSets.singleton(e);
    }
    
    default ByteSet of(final byte e0, final byte e1) {
        final ByteArraySet innerSet = new ByteArraySet(2);
        innerSet.add(e0);
        if (!innerSet.add(e1)) {
            throw new IllegalArgumentException("Duplicate element: " + e1);
        }
        return ByteSets.unmodifiable(innerSet);
    }
    
    default ByteSet of(final byte e0, final byte e1, final byte e2) {
        final ByteArraySet innerSet = new ByteArraySet(3);
        innerSet.add(e0);
        if (!innerSet.add(e1)) {
            throw new IllegalArgumentException("Duplicate element: " + e1);
        }
        if (!innerSet.add(e2)) {
            throw new IllegalArgumentException("Duplicate element: " + e2);
        }
        return ByteSets.unmodifiable(innerSet);
    }
    
    default ByteSet of(final byte... a) {
        switch (a.length) {
            case 0: {
                return of();
            }
            case 1: {
                return of(a[0]);
            }
            case 2: {
                return of(a[0], a[1]);
            }
            case 3: {
                return of(a[0], a[1], a[2]);
            }
            default: {
                final ByteSet innerSet = (ByteSet)((a.length <= 4) ? new ByteArraySet(a.length) : new ByteOpenHashSet(a.length));
                for (final byte element : a) {
                    if (!innerSet.add(element)) {
                        throw new IllegalArgumentException("Duplicate element: " + element);
                    }
                }
                return ByteSets.unmodifiable(innerSet);
            }
        }
    }
}
