Interface Size64

All Known Subinterfaces:
BigList<K>, BooleanBigList, ByteBigList, CharBigList, DoubleBigList, FloatBigList, IntBigList, LongBigList, ObjectBigList<K>, ReferenceBigList<K>, ShortBigList
All Known Implementing Classes:
AbstractBooleanBigList, AbstractBooleanBigList.BooleanRandomAccessSubList, AbstractBooleanBigList.BooleanSubList, AbstractByteBigList, AbstractByteBigList.ByteRandomAccessSubList, AbstractByteBigList.ByteSubList, AbstractCharBigList, AbstractCharBigList.CharRandomAccessSubList, AbstractCharBigList.CharSubList, AbstractDoubleBigList, AbstractDoubleBigList.DoubleRandomAccessSubList, AbstractDoubleBigList.DoubleSubList, AbstractFloatBigList, AbstractFloatBigList.FloatRandomAccessSubList, AbstractFloatBigList.FloatSubList, AbstractIntBigList, AbstractIntBigList.IntRandomAccessSubList, AbstractIntBigList.IntSubList, AbstractLongBigList, AbstractLongBigList.LongRandomAccessSubList, AbstractLongBigList.LongSubList, AbstractObjectBigList, AbstractObjectBigList.ObjectRandomAccessSubList, AbstractObjectBigList.ObjectSubList, AbstractReferenceBigList, AbstractReferenceBigList.ReferenceRandomAccessSubList, AbstractReferenceBigList.ReferenceSubList, AbstractShortBigList, AbstractShortBigList.ShortRandomAccessSubList, AbstractShortBigList.ShortSubList, BooleanBigArrayBigList, BooleanBigLists.EmptyBigList, BooleanBigLists.ListBigList, BooleanBigLists.Singleton, BooleanBigLists.SynchronizedBigList, BooleanBigLists.UnmodifiableBigList, ByteArrayFrontCodedBigList, ByteBigArrayBigList, ByteBigLists.EmptyBigList, ByteBigLists.ListBigList, ByteBigLists.Singleton, ByteBigLists.SynchronizedBigList, ByteBigLists.UnmodifiableBigList, CharArrayFrontCodedBigList, CharBigArrayBigList, CharBigLists.EmptyBigList, CharBigLists.ListBigList, CharBigLists.Singleton, CharBigLists.SynchronizedBigList, CharBigLists.UnmodifiableBigList, DoubleBigArrayBigList, DoubleBigLists.EmptyBigList, DoubleBigLists.ListBigList, DoubleBigLists.Singleton, DoubleBigLists.SynchronizedBigList, DoubleBigLists.UnmodifiableBigList, DoubleOpenHashBigSet, FloatBigArrayBigList, FloatBigLists.EmptyBigList, FloatBigLists.ListBigList, FloatBigLists.Singleton, FloatBigLists.SynchronizedBigList, FloatBigLists.UnmodifiableBigList, FloatOpenHashBigSet, IntArrayFrontCodedBigList, IntBigArrayBigList, IntBigLists.EmptyBigList, IntBigLists.ListBigList, IntBigLists.Singleton, IntBigLists.SynchronizedBigList, IntBigLists.UnmodifiableBigList, IntOpenHashBigSet, LongArrayFrontCodedBigList, LongBigArrayBigList, LongBigLists.EmptyBigList, LongBigLists.ListBigList, LongBigLists.Singleton, LongBigLists.SynchronizedBigList, LongBigLists.UnmodifiableBigList, LongOpenHashBigSet, ObjectBigArrayBigList, ObjectBigLists.EmptyBigList, ObjectBigLists.ListBigList, ObjectBigLists.Singleton, ObjectBigLists.SynchronizedBigList, ObjectBigLists.UnmodifiableBigList, ObjectOpenHashBigSet, ReferenceBigArrayBigList, ReferenceBigLists.EmptyBigList, ReferenceBigLists.ListBigList, ReferenceBigLists.Singleton, ReferenceBigLists.SynchronizedBigList, ReferenceBigLists.UnmodifiableBigList, ReferenceOpenHashBigSet, ShortArrayFrontCodedBigList, ShortBigArrayBigList, ShortBigLists.EmptyBigList, ShortBigLists.ListBigList, ShortBigLists.Singleton, ShortBigLists.SynchronizedBigList, ShortBigLists.UnmodifiableBigList

public interface Size64
An interface for data structures whose size can exceed Integer.MAX_VALUE.

The only methods specified by this interfaces are size64(), and a deprecated size() identical to Collection.size(), but with a default implementation. Implementations can work around the type problem of Collection.size() (e.g., not being able to return more than Integer.MAX_VALUE) by implementing this interface. Callers interested in large structures can use a reflective call to instanceof to check for the presence of size64().

  • Method Summary

    Modifier and Type Method Description
    default int size()
    Deprecated.
    Use size64() instead.
    long size64()
    Returns the size of this data structure as a long.
    static long sizeOf​(java.util.Collection<?> c)
    Returns the size for a given Collection as a long, using size64() if applicable, else using Collection.size().
    static long sizeOf​(java.util.Map<?,​?> m)
    Returns the size for a given Map as a long, using size64() if applicable, else using Map.size().
  • Method Details

    • size64

      long size64()
      Returns the size of this data structure as a long.
      Returns:
      the size of this data structure.
    • size

      @Deprecated default int size()
      Deprecated.
      Use size64() instead.
      Returns the size of this data structure, minimized with Integer.MAX_VALUE.

      This default implementation follows the definition above, which is compatible with Collection.size().

      Returns:
      the size of this data structure, minimized with Integer.MAX_VALUE.
      See Also:
      Collection.size()
    • sizeOf

      static long sizeOf​(java.util.Collection<?> c)
      Returns the size for a given Collection as a long, using size64() if applicable, else using Collection.size().
      Parameters:
      c - the collection whose size to get
      Returns:
      the size
    • sizeOf

      static long sizeOf​(java.util.Map<?,​?> m)
      Returns the size for a given Map as a long, using size64() if applicable, else using Map.size().
      Parameters:
      m - the map whose size to get
      Returns:
      the size