Class DenseImmutableTable<R,C,V>

All Implemented Interfaces:
Table<R,C,V>, Serializable

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

    • rowKeyToIndex

      private final ImmutableMap<R,Integer> rowKeyToIndex
    • columnKeyToIndex

      private final ImmutableMap<C,Integer> columnKeyToIndex
    • rowMap

      private final ImmutableMap<R,ImmutableMap<C,V>> rowMap
    • columnMap

      private final ImmutableMap<C,ImmutableMap<R,V>> columnMap
    • 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
  • Constructor Details

  • Method Details

    • columnMap

      public ImmutableMap<C,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,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 Object rowKey, @CheckForNull 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.
    • getCell

      Table.Cell<R,C,V> getCell(int index)
      Specified by:
      getCell in class RegularImmutableTable<R,C,V>
    • getValue

      V getValue(int index)
      Specified by:
      getValue in class RegularImmutableTable<R,C,V>
    • writeReplace

      Object writeReplace()
      Specified by:
      writeReplace in class RegularImmutableTable<R,C,V>