Interface ObjectCollection<K>
- All Superinterfaces:
java.util.Collection<K>
,java.lang.Iterable<K>
,ObjectIterable<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>
,ObjectBigList<K>
,ObjectList<K>
,ObjectSet<K>
,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
,AbstractObjectBigList
,AbstractObjectBigList.ObjectRandomAccessSubList
,AbstractObjectBigList.ObjectSubList
,AbstractObjectCollection
,AbstractObjectList
,AbstractObjectList.ObjectRandomAccessSubList
,AbstractObjectList.ObjectSubList
,AbstractObjectSet
,AbstractObjectSortedSet
,IntArrayFrontCodedBigList
,IntArrayFrontCodedList
,LongArrayFrontCodedBigList
,LongArrayFrontCodedList
,ObjectArrayList
,ObjectArraySet
,ObjectAVLTreeSet
,ObjectBigArrayBigList
,ObjectBigLists.EmptyBigList
,ObjectBigLists.ListBigList
,ObjectBigLists.Singleton
,ObjectBigLists.SynchronizedBigList
,ObjectBigLists.UnmodifiableBigList
,ObjectCollections.EmptyCollection
,ObjectCollections.IterableCollection
,ObjectImmutableList
,ObjectLinkedOpenCustomHashSet
,ObjectLinkedOpenHashSet
,ObjectLists.EmptyList
,ObjectLists.Singleton
,ObjectLists.SynchronizedList
,ObjectLists.SynchronizedRandomAccessList
,ObjectLists.UnmodifiableList
,ObjectLists.UnmodifiableRandomAccessList
,ObjectOpenCustomHashSet
,ObjectOpenHashBigSet
,ObjectOpenHashSet
,ObjectRBTreeSet
,ObjectSets.EmptySet
,ObjectSets.Singleton
,ObjectSets.SynchronizedSet
,ObjectSets.UnmodifiableSet
,ObjectSortedSets.EmptySet
,ObjectSortedSets.Singleton
,ObjectSortedSets.SynchronizedSortedSet
,ObjectSortedSets.UnmodifiableSortedSet
public interface ObjectCollection<K> extends java.util.Collection<K>, ObjectIterable<K>
Collection
; provides some additional methods that use
polymorphism to avoid (un)boxing.
Additionally, this class defines strengthens (again) iterator()
.
This interface specifies reference equality semantics (members will be
compared equal with ==
instead of equals
), which may result in breaks in contract if attempted to be used with
non reference-equality semantics based Collection
s. For example, a
aReferenceCollection.equals(aObjectCollection)
may return different a
different result then aObjectCollection.equals(aReferenceCollection)
,
in violation of equals
's contract requiring it being
symmetric.
- See Also:
Collection
-
Method Summary
Modifier and Type Method Description ObjectIterator<K>
iterator()
Returns a type-specific iterator on the elements of this collection.default ObjectSpliterator<K>
spliterator()
Returns a type-specific spliterator on the elements of this collection.Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, size, stream, toArray, toArray, toArray
Methods inherited from interface java.lang.Iterable
forEach
-
Method Details
-
iterator
ObjectIterator<K> iterator()Returns a type-specific iterator on the elements of this collection.- Specified by:
iterator
in interfacejava.util.Collection<K>
- Specified by:
iterator
in interfacejava.lang.Iterable<K>
- Specified by:
iterator
in interfaceObjectIterable<K>
- Returns:
- a type-specific iterator on the elements of this collection.
- 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 extendsCollection
.
-
spliterator
Returns a type-specific spliterator on the elements of this collection.See
Collection.spliterator()
for more documentation on the requirements of the returned spliterator.- Specified by:
spliterator
in interfacejava.util.Collection<K>
- Specified by:
spliterator
in interfacejava.lang.Iterable<K>
- Specified by:
spliterator
in interfaceObjectIterable<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()
.Also, this is generally the only
spliterator
method subclasses should override. - Implementation Specification:
- The default implementation returns a late-binding spliterator (see
Spliterator
for documentation on what binding policies mean) that wraps this instance's type specificiterator()
.Additionally, it reports
Spliterator.SIZED
- Implementation Notes:
- As this default implementation wraps the iterator, and
Iterator
is 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.
-