Interface Size64

All Known Subinterfaces:
BigList<K>

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
    Deprecated.
    Use size64() instead.
    long
    Returns the size of this data structure as a long.
    static long
    Returns the size for a given Collection as a long, using size64() if applicable, else using Collection.size().
    static long
    sizeOf(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:
    • sizeOf

      static long sizeOf(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(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