package speiger.src.collections.PACKAGE.sets; import java.util.Set; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; /** * A Type Specific Set class to reduce boxing/unboxing * @Type(T) */ public interface SET KEY_GENERIC_TYPE extends Set, COLLECTION KEY_GENERIC_TYPE { @Override public ITERATOR KEY_GENERIC_TYPE iterator(); #if !TYPE_OBJECT /** * A Type Specific remove function to reduce boxing/unboxing * @param o the element that should be removed * @return true if the element was removed */ public boolean remove(KEY_TYPE o); @Override public default boolean REMOVE_KEY(KEY_TYPE o) { return remove(o); } @Override @Primitive public default boolean add(CLASS_TYPE e) { return COLLECTION.super.add(e); } @Override @Primitive public default boolean contains(Object o) { return COLLECTION.super.contains(o); } @Override @Primitive public default boolean remove(Object o) { return COLLECTION.super.remove(o); } #endif /** * A Type Specific Type Splititerator to reduce boxing/unboxing * @return type specific splititerator */ @Override default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 0); } }