Class SingletonImmutableTable<R,C,V>

java.lang.Object
com.google.common.collect.AbstractTable<R,C,V>
com.google.common.collect.ImmutableTable<R,C,V>
com.google.common.collect.SingletonImmutableTable<R,C,V>
All Implemented Interfaces:
Table<R,C,V>, Serializable

class SingletonImmutableTable<R,C,V> extends ImmutableTable<R,C,V>
An implementation of ImmutableTable that holds a single cell.
  • Field Details

    • singleRowKey

      final R singleRowKey
    • singleColumnKey

      final C singleColumnKey
    • singleValue

      final V singleValue
  • Constructor Details

    • SingletonImmutableTable

      SingletonImmutableTable(R rowKey, C columnKey, V value)
    • SingletonImmutableTable

      SingletonImmutableTable(Table.Cell<R,C,V> cell)
  • Method Details

    • column

      public ImmutableMap<R,V> column(C columnKey)
      Description copied from class: ImmutableTable
      Returns a view of all mappings that have the given column key. For each row key / column key / value mapping in the table with that column key, the returned map associates the row key with the value. If no mappings in the table have the provided column key, an empty map is returned.

      Changes to the returned map will update the underlying table, and vice versa.

      Specified by:
      column in interface Table<R,C,V>
      Overrides:
      column in class ImmutableTable<R,C,V>
      Parameters:
      columnKey - key of column to search for in the table
      Returns:
      the corresponding map from row keys to values
    • 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
    • size

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

      ImmutableSet<Table.Cell<R,C,V>> createCellSet()
      Specified by:
      createCellSet in class ImmutableTable<R,C,V>
    • createValues

      ImmutableCollection<V> createValues()
      Specified by:
      createValues in class ImmutableTable<R,C,V>
    • writeReplace

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