@GwtCompatible @Beta public final class Tables extends Object
Table
.Modifier and Type | Method and Description |
---|---|
static <R,C,V> Table.Cell<R,C,V> |
immutableCell(R rowKey,
C columnKey,
V value)
Returns an immutable cell with the specified row key, column key, and
value.
|
static <R,C,V> Table<C,R,V> |
transpose(Table<R,C,V> table)
Creates a transposed view of a given table that flips its row and column
keys.
|
public static <R,C,V> Table.Cell<R,C,V> immutableCell(@Nullable R rowKey, @Nullable C columnKey, @Nullable V value)
The returned cell is serializable.
rowKey
- the row key to be associated with the returned cellcolumnKey
- the column key to be associated with the returned cellvalue
- the value to be associated with the returned cellpublic static <R,C,V> Table<C,R,V> transpose(Table<R,C,V> table)
get(columnKey, rowKey)
on the
generated table always returns the same value as calling get(rowKey, columnKey)
on the original table. Updating the original table
changes the contents of the transposed table and vice versa.
The returned table supports update operations as long as the input table
supports the analogous operation with swapped rows and columns. For
example, in a HashBasedTable
instance, rowKeySet().iterator()
supports remove()
but columnKeySet().iterator()
doesn't. With a transposed HashBasedTable
, it's the other way around.