Interface ObjectCollection<K>

All Superinterfaces:
Collection<K>, Iterable<K>, ObjectIterable<K>
All Known Subinterfaces:
ObjectList<K>
All Known Implementing Classes:
AbstractObjectCollection, AbstractObjectList, AbstractObjectList.ObjectRandomAccessSubList, AbstractObjectList.ObjectSubList, ObjectArrayList, ObjectArrayList.SubList, ObjectCollections.EmptyCollection, ObjectCollections.IterableCollection, ObjectImmutableList, ObjectLists.EmptyList, ObjectLists.Singleton, ObjectLists.SynchronizedList, ObjectLists.SynchronizedRandomAccessList, ObjectLists.UnmodifiableList, ObjectLists.UnmodifiableRandomAccessList

public interface ObjectCollection<K> extends Collection<K>, ObjectIterable<K>
A type-specific 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 Collections. 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:
  • Method Details

    • iterator

      it.unimi.dsi.fastutil.objects.ObjectIterator<K> iterator()
      Returns a type-specific iterator on the elements of this collection.
      Specified by:
      iterator in interface Collection<K>
      Specified by:
      iterator in interface Iterable<K>
      Specified by:
      iterator in interface ObjectIterable<K>
      Returns:
      a type-specific iterator on the elements of this collection.
      See Also:
    • spliterator

      default it.unimi.dsi.fastutil.objects.ObjectSpliterator<K> 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 interface Collection<K>
      Specified by:
      spliterator in interface Iterable<K>
      Specified by:
      spliterator in interface ObjectIterable<K>
      Returns:
      a type-specific spliterator on the elements of this collection.
      Since:
      8.5.0