Class StandardRowSortedTable<R,C,V>

java.lang.Object
com.google.common.collect.AbstractTable<R,C,V>
com.google.common.collect.StandardTable<R,C,V>
com.google.common.collect.StandardRowSortedTable<R,C,V>
All Implemented Interfaces:
RowSortedTable<R,C,V>, Table<R,C,V>, Serializable
Direct Known Subclasses:
TreeBasedTable

class StandardRowSortedTable<R,C,V> extends StandardTable<R,C,V> implements RowSortedTable<R,C,V>
Implementation of Table whose iteration ordering across row keys is sorted by their natural ordering or by a supplied comparator. Note that iterations across the columns keys for a single row key may or may not be ordered, depending on the implementation. When rows and columns are both sorted, it's easier to use the TreeBasedTable subclass.

The rowKeySet() method returns a SortedSet and the rowMap() method returns a SortedMap, instead of the Set and Map specified by the Table interface.

Null keys and values are not supported.

See the StandardTable superclass for more information about the behavior of this class.

  • Field Details

  • Constructor Details

  • Method Details

    • sortedBackingMap

      private SortedMap<R,Map<C,V>> sortedBackingMap()
    • rowKeySet

      public SortedSet<R> rowKeySet()
      Returns a set of row keys that have one or more values in the table. Changes to the set will update the underlying table, and vice versa.

      This method returns a SortedSet, instead of the Set specified in the Table interface.

      Specified by:
      rowKeySet in interface RowSortedTable<R,C,V>
      Specified by:
      rowKeySet in interface Table<R,C,V>
      Overrides:
      rowKeySet in class StandardTable<R,C,V>
      Returns:
      set of row keys
    • rowMap

      public SortedMap<R,Map<C,V>> rowMap()
      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().

      This method returns a SortedMap, instead of the Map specified in the Table interface.

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

      SortedMap<R,Map<C,V>> createRowMap()
      Overrides:
      createRowMap in class StandardTable<R,C,V>