Interface Size64

All Known Subinterfaces:
BigList<K>, DoubleBigList, IntBigList, LongBigList, ObjectBigList<K>
All Known Implementing Classes:
AbstractDoubleBigList, AbstractDoubleBigList.DoubleRandomAccessSubList, AbstractDoubleBigList.DoubleSubList, AbstractIntBigList, AbstractIntBigList.IntRandomAccessSubList, AbstractIntBigList.IntSubList, AbstractLongBigList, AbstractLongBigList.LongRandomAccessSubList, AbstractLongBigList.LongSubList, AbstractObjectBigList, AbstractObjectBigList.ObjectRandomAccessSubList, AbstractObjectBigList.ObjectSubList, DoubleBigArrayBigList, DoubleBigLists.EmptyBigList, DoubleBigLists.ListBigList, DoubleBigLists.Singleton, DoubleBigLists.SynchronizedBigList, DoubleBigLists.UnmodifiableBigList, DoubleOpenHashBigSet, 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

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