android/guava/src/com/google/common/collect/Tables.java
public static <R, C, V> Table<C, R, V> transpose(Table<R, C, V> table) {
    return (table instanceof TransposeTable)
        ? ((TransposeTable<R, C, V>) table).original
        : new TransposeTable<C, R, V>(table);
  }
public static <R, C, V> Table<C, R, V> transpose(Table<R, C, V> table) {
    return (table instanceof TransposeTable)
        ? ((TransposeTable<R, C, V>) table).original
        : new TransposeTable<C, R, V>(table);
  }
Creates a transposed view of a given table that flips its row and column keys. In other words,
calling {@code get(columnKey, rowKey)} on the generated table always returns the same value as
calling {@code get(rowKey, columnKey)} on the original table. Updating the original table
changes the contents of the transposed table and vice versa.

<p>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 {@link HashBasedTable}
instance, {@code rowKeySet().iterator()} supports {@code remove()} but {@code
columnKeySet().iterator()} doesn't. With a transposed {@link HashBasedTable}, it's the other
way around.