Class DenseImmutableTable<R,​C,​V>

  • All Implemented Interfaces:
    Table<R,​C,​V>, java.io.Serializable

    final class DenseImmutableTable<R,​C,​V>
    extends RegularImmutableTable<R,​C,​V>
    A RegularImmutableTable optimized for dense data.
    • Field Detail

      • rowKeyToIndex

        private final ImmutableMap<R,​java.lang.Integer> rowKeyToIndex
      • columnKeyToIndex

        private final ImmutableMap<C,​java.lang.Integer> columnKeyToIndex
      • rowCounts

        private final int[] rowCounts
      • columnCounts

        private final int[] columnCounts
      • values

        private final V[][] values
      • cellRowIndices

        private final int[] cellRowIndices
      • cellColumnIndices

        private final int[] cellColumnIndices
    • Method Detail

      • columnMap

        public ImmutableMap<C,​java.util.Map<R,​V>> columnMap()
        Description copied from class: ImmutableTable
        Returns a view that associates each column key with the corresponding map from row keys to values. Changes to the returned map will update this table. The returned map does not support put() or putAll(), or setValue() on its entries.

        In contrast, the maps returned by columnMap().get() have the same behavior as those returned by Table.column(C). Those maps may support setValue(), put(), and putAll().

        The value Map<R, V> instances in the returned map are ImmutableMap instances as well.

        Specified by:
        columnMap in interface Table<R,​C,​V>
        Specified by:
        columnMap in class ImmutableTable<R,​C,​V>
        Returns:
        a map view from each column key to a secondary map from row keys to values
      • rowMap

        public ImmutableMap<R,​java.util.Map<C,​V>> rowMap()
        Description copied from class: ImmutableTable
        Returns a view that associates each row key with the corresponding map from column keys to values. Changes to the returned map will update this table. The returned map does not support put() or putAll(), or setValue() on its entries.

        In contrast, the maps returned by rowMap().get() have the same behavior as those returned by Table.row(R). Those maps may support setValue(), put(), and putAll().

        The value Map<C, V> instances in the returned map are ImmutableMap instances as well.

        Specified by:
        rowMap in interface Table<R,​C,​V>
        Specified by:
        rowMap in class ImmutableTable<R,​C,​V>
        Returns:
        a map view from each row key to a secondary map from column keys to values
      • get

        @CheckForNull
        public V get​(@CheckForNull
                     java.lang.Object rowKey,
                     @CheckForNull
                     java.lang.Object columnKey)
        Description copied from interface: Table
        Returns the value corresponding to the given row and column keys, or null if no such mapping exists.
        Specified by:
        get in interface Table<R,​C,​V>
        Overrides:
        get in class AbstractTable<R,​C,​V>
        Parameters:
        rowKey - key of row to search for
        columnKey - key of column to search for
      • size

        public int size()
        Description copied from interface: Table
        Returns the number of row key / column key / value mappings in the table.