Interface MemoizedSparseCollection<T>

Type Parameters:
T - Type of memoized items
All Known Implementing Classes:
MemoizingIterator, SmilesMemoizingMoleculeIterator

@Beta @PublicAPI @Deprecated(forRemoval=true) @SubjectToRemoval(date=JAN_01_2025) public interface MemoizedSparseCollection<T>
Deprecated, for removal: This API element is subject to removal in a future version.
Will be removed without replacement.
Represents an ordered sparse collection of memoized items.

Typical usage is to retrieve structure sources captured during import.

Note that the typical usage of term Memoization usually refers to an operation of storing the results of a potentially expensive calculation (see https://en.wikipedia.org/wiki/Memoization.

  • Method Summary

    Modifier and Type
    Method
    Description
    getMemoized(int i)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get a non-missing memoiozed.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Function to access captured non-missing memoizeds.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get item when present.
    getMemoizedOrDefault(int i, T defaultValue)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get item when present or a default value when missing.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Function to access present items with a default value for missing items.
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
    Collected items count.
  • Method Details

    • size

      int size()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Collected items count.

      Including missing items.

      Returns:
      collected items count
    • getMemoizedIfPresent

      Optional<T> getMemoizedIfPresent(int i)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get item when present.
      Parameters:
      i - Index which refers to either a missing or a present element
      Returns:
      Collected remembered element
    • getMemoizedOrDefault

      T getMemoizedOrDefault(int i, T defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get item when present or a default value when missing.
      Parameters:
      i - Index which refers to either a missing or a present element
      defaultValue - value for return when missing
      Returns:
      Collected remembered element or default when missing
    • getMemoized

      T getMemoized(int i) throws NoSuchElementException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get a non-missing memoiozed.
      Parameters:
      i - Index of an item which is not missing
      Returns:
      Collected remembered item
      Throws:
      NoSuchElementException - when given index refers to a missing item
    • getMemoizedFunction

      Function<Integer,T> getMemoizedFunction()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Function to access captured non-missing memoizeds.
      Returns:
      A Function of Integer to the memoized type T which delegates to getMemoized(int)
    • getMemoizedOrDefaultFunction

      Function<Integer,T> getMemoizedOrDefaultFunction(T defaultValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Function to access present items with a default value for missing items.
      Parameters:
      defaultValue - Value to return for missing items.
      Returns:
      A Function of Integer to the memoized type T which delegates to getMemoizedOrDefault(int, java.lang.Object)