All Downloads are FREE. Search and download functionalities are using the official Maven repository.

marcel.lang.primitives.collections.sets.LongSet Maven / Gradle / Ivy

package marcel.lang.primitives.collections.sets;

import marcel.lang.primitives.collections.LongCollection;
import marcel.lang.primitives.collections.lists.LongArrayList;
import marcel.lang.primitives.collections.lists.LongList;
import marcel.lang.primitives.iterators.LongIterator;
import marcel.lang.primitives.spliterators.LongSpliterator;
import marcel.lang.primitives.spliterators.LongSpliterators;

import java.util.Set;
import java.util.function.LongPredicate;

public interface LongSet extends LongCollection, Set {
	/** Returns a type-specific iterator on the elements of this set.
	 *
	 * This specification strengthens the one given in {@link Iterable#iterator()},
	 * which was already strengthened in the corresponding type-specific class,
	 * but was weakened by the fact that this interface extends {@link Set}.
	 * 

Also, this is generally the only {@code iterator} method subclasses should override. * * @return a type-specific iterator on the elements of this set. */ @Override LongIterator iterator(); /** * Returns a type-specific spliterator on the elements of this set. * *

Set spliterators must report at least Spliterator#DISTINCT. * *

See {@link Set#spliterator()} for more documentation on the requirements * of the returned spliterator. * * This specification strengthens the one given in * {@link java.util.Collection#spliterator()}, which was already * strengthened in the corresponding type-specific class, * but was weakened by the fact that this interface extends {@link Set}. *

Also, this is generally the only {@code spliterator} method subclasses should override. * * The default implementation returns a late-binding spliterator (see * Spliterator for documentation on what binding policies mean) * that wraps this instance's type specific {@link #iterator}. *

Additionally, it reports Spliterator#SIZED and Spliterator#DISTINCT. * * As this default implementation wraps the iterator, and {@link java.util.Iterator} * is an inherently linear API, the returned spliterator will yield limited performance gains * when run in parallel contexts, as the returned spliterator's * Spliterator#trySplit() will have linear runtime. * * @return {@inheritDoc} * @since 8.5.0 */ @Override default LongSpliterator spliterator() { return LongSpliterators.asSpliterator( iterator(), size(), LongSpliterators.SET_SPLITERATOR_CHARACTERISTICS); } /** Removes an element from this set. * * Note that the corresponding method of a type-specific collection is {@code rem()}. * This unfortunate situation is caused by the clash * with the similarly named index-based method in the {@link java.util.List} interface. * * @see java.util.Collection#remove(Object) */ boolean remove(long k); @Override default boolean removeLong(long key) { return remove(key); } /** {@inheritDoc} * @deprecated Please use the corresponding type-specific method instead. */ @SuppressWarnings("deprecation") @Deprecated @Override default boolean remove(final Object o) { return LongCollection.super.remove(o); } /** {@inheritDoc} * @deprecated Please use the corresponding type-specific method instead. */ @SuppressWarnings("deprecation") @Deprecated @Override default boolean add(final Long o) { return LongCollection.super.add(o); } /** {@inheritDoc} * @deprecated Please use the corresponding type-specific method instead. */ @SuppressWarnings("deprecation") @Deprecated @Override default boolean contains(final Object o) { return LongCollection.super.contains(o); } default LongSet asUnmodifiable() { return new UnmodifiableLongSet(this); } default LongSet toImmutable() { return new UnmodifiableLongSet(new LongOpenHashSet(this)); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy