Package it.unimi.dsi.fastutil.objects
Interface ObjectSet<K>
- All Superinterfaces:
java.util.Collection<K>,java.lang.Iterable<K>,ObjectCollection<K>,ObjectIterable<K>,java.util.Set<K>
- All Known Subinterfaces:
Double2DoubleMap.FastEntrySet,Double2DoubleSortedMap.FastSortedEntrySet,Double2IntMap.FastEntrySet,Double2IntSortedMap.FastSortedEntrySet,Double2LongMap.FastEntrySet,Double2LongSortedMap.FastSortedEntrySet,Double2ObjectMap.FastEntrySet<V>,Double2ObjectSortedMap.FastSortedEntrySet<V>,Int2DoubleMap.FastEntrySet,Int2DoubleSortedMap.FastSortedEntrySet,Int2IntMap.FastEntrySet,Int2IntSortedMap.FastSortedEntrySet,Int2LongMap.FastEntrySet,Int2LongSortedMap.FastSortedEntrySet,Int2ObjectMap.FastEntrySet<V>,Int2ObjectSortedMap.FastSortedEntrySet<V>,Long2DoubleMap.FastEntrySet,Long2DoubleSortedMap.FastSortedEntrySet,Long2IntMap.FastEntrySet,Long2IntSortedMap.FastSortedEntrySet,Long2LongMap.FastEntrySet,Long2LongSortedMap.FastSortedEntrySet,Long2ObjectMap.FastEntrySet<V>,Long2ObjectSortedMap.FastSortedEntrySet<V>,Object2DoubleMap.FastEntrySet<K>,Object2DoubleSortedMap.FastSortedEntrySet<K>,Object2IntMap.FastEntrySet<K>,Object2IntSortedMap.FastSortedEntrySet<K>,Object2LongMap.FastEntrySet<K>,Object2LongSortedMap.FastSortedEntrySet<K>,Object2ObjectMap.FastEntrySet<K,V>,Object2ObjectSortedMap.FastSortedEntrySet<K,V>,ObjectSortedSet<K>
- All Known Implementing Classes:
AbstractDouble2DoubleMap.BasicEntrySet,AbstractDouble2IntMap.BasicEntrySet,AbstractDouble2LongMap.BasicEntrySet,AbstractDouble2ObjectMap.BasicEntrySet,AbstractInt2DoubleMap.BasicEntrySet,AbstractInt2IntMap.BasicEntrySet,AbstractInt2LongMap.BasicEntrySet,AbstractInt2ObjectMap.BasicEntrySet,AbstractLong2DoubleMap.BasicEntrySet,AbstractLong2IntMap.BasicEntrySet,AbstractLong2LongMap.BasicEntrySet,AbstractLong2ObjectMap.BasicEntrySet,AbstractObject2DoubleMap.BasicEntrySet,AbstractObject2IntMap.BasicEntrySet,AbstractObject2LongMap.BasicEntrySet,AbstractObject2ObjectMap.BasicEntrySet,AbstractObjectSet,AbstractObjectSortedSet,ObjectArraySet,ObjectAVLTreeSet,ObjectLinkedOpenCustomHashSet,ObjectLinkedOpenHashSet,ObjectOpenCustomHashSet,ObjectOpenHashBigSet,ObjectOpenHashSet,ObjectRBTreeSet,ObjectSets.EmptySet,ObjectSets.Singleton,ObjectSets.SynchronizedSet,ObjectSets.UnmodifiableSet,ObjectSortedSets.EmptySet,ObjectSortedSets.Singleton,ObjectSortedSets.SynchronizedSortedSet,ObjectSortedSets.UnmodifiableSortedSet
public interface ObjectSet<K> extends ObjectCollection<K>, java.util.Set<K>
A type-specific
Set; provides some additional methods that use
polymorphism to avoid (un)boxing.
Additionally, this interface strengthens (again) iterator().
- See Also:
Set
-
Method Summary
Modifier and Type Method Description ObjectIterator<K>iterator()Returns a type-specific iterator on the elements of this set.static <K> ObjectSet<K>of()Returns an immutable empty set.static <K> ObjectSet<K>of(K e)Returns an immutable set with the element given.static <K> ObjectSet<K>of(K... a)Returns an immutable list with the elements given.static <K> ObjectSet<K>of(K e0, K e1)Returns an immutable set with the elements given.static <K> ObjectSet<K>of(K e0, K e1, K e2)Returns an immutable set with the elements given.default ObjectSpliterator<K>spliterator()Returns a type-specific spliterator on the elements of this set.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.lang.Iterable
forEachMethods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
-
Method Details
-
iterator
ObjectIterator<K> iterator()Returns a type-specific iterator on the elements of this set.- Specified by:
iteratorin interfacejava.util.Collection<K>- Specified by:
iteratorin interfacejava.lang.Iterable<K>- Specified by:
iteratorin interfaceObjectCollection<K>- Specified by:
iteratorin interfaceObjectIterable<K>- Specified by:
iteratorin interfacejava.util.Set<K>- Returns:
- a type-specific iterator on the elements of this set.
- See Also:
Iterable.iterator()- API Notes:
- This specification strengthens the one given in
Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extendsSet.Also, this is generally the only
iteratormethod subclasses should override.
-
spliterator
Returns a type-specific spliterator on the elements of this set.Set spliterators must report at least
Spliterator.DISTINCT.See
Set.spliterator()for more documentation on the requirements of the returned spliterator.- Specified by:
spliteratorin interfacejava.util.Collection<K>- Specified by:
spliteratorin interfacejava.lang.Iterable<K>- Specified by:
spliteratorin interfaceObjectCollection<K>- Specified by:
spliteratorin interfaceObjectIterable<K>- Specified by:
spliteratorin interfacejava.util.Set<K>- Returns:
- a type-specific spliterator on the elements of this collection.
- Since:
- 8.5.0
- API Notes:
- This specification strengthens the one given in
Collection.spliterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extendsSet.Also, this is generally the only
spliteratormethod subclasses should override. - Implementation Specification:
- The default implementation returns a late-binding spliterator (see
Spliteratorfor documentation on what binding policies mean) that wraps this instance's type specificiterator().Additionally, it reports
Spliterator.SIZEDandSpliterator.DISTINCT. - Implementation Notes:
- As this default implementation wraps the iterator, and
Iteratoris an inherently linear API, the returned spliterator will yield limited performance gains when run in parallel contexts, as the returned spliterator'strySplit()will have linear runtime.
-
of
Returns an immutable empty set.- Returns:
- an immutable empty set.
-
of
Returns an immutable set with the element given.- Parameters:
e- an element.- Returns:
- an immutable set containing
e.
-
of
Returns an immutable set with the elements given.- Parameters:
e0- the first element.e1- the second element.- Returns:
- an immutable set containing
e0ande1. - Throws:
java.lang.IllegalArgumentException- if there were duplicate entries.
-
of
Returns an immutable set with the elements given.- Parameters:
e0- the first element.e1- the second element.e2- the third element.- Returns:
- an immutable set containing
e0,e1, ande2. - Throws:
java.lang.IllegalArgumentException- if there were duplicate entries.
-
of
Returns an immutable list with the elements given.- Parameters:
a- the list of elements that will be in the final set.- Returns:
- an immutable set containing the elements in
a. - Throws:
java.lang.IllegalArgumentException- if there are any duplicate entries.
-