code: public static <R, C, V> ImmutableTable<R, C, V> copyOf(
        Table<? extends R, ? extends C, ? extends V> table) {
      if (table instanceof ImmutableTable) {
        @SuppressWarnings("unchecked")
        ImmutableTable<R, C, V> parameterizedTable = (ImmutableTable<R, C, V>) table;
        return parameterizedTable;
      } else {
        int size = table.size();
        switch (size) {
          case 0:
            return of();
          case 1:
            Cell<? extends R, ? extends C, ? extends V> onlyCell =
                Iterables.getOnlyElement(table.cellSet());
            return ImmutableTable.<R, C, V>of(
                onlyCell.getRowKey(), onlyCell.getColumnKey(), onlyCell.getValue());
          default:
            ImmutableSet.Builder<Cell<R, C, V>> cellSetBuilder =
                new ImmutableSet.Builder<Cell<R, C, V>>(size);
            for (Cell<? extends R, ? extends C, ? extends V> cell : table.cellSet()) {
              /*
               * Must cast to be able to create a Cell<R, C, V> rather than a
               * Cell<? extends R, ? extends C, ? extends V>
               */
              cellSetBuilder.add(
                  cellOf((R) cell.getRowKey(), (C) cell.getColumnKey(), (V) cell.getValue()));
            }
            return RegularImmutableTable.forCells(cellSetBuilder.build());
        }
      }
    }
docs: Returns an immutable copy of the provided table.
  
  <p>The {@link Table#cellSet()} iteration order of the provided table
  determines the iteration ordering of all views in the returned table. Note
  that some views of the original table and the copied table may have
  different iteration orders. For more control over the ordering, create a
  {@link Builder} and call {@link Builder#orderRowsBy},
  {@link Builder#orderColumnsBy}, and {@link Builder#putAll}
  
  <p>Despite the method name, this method attempts to avoid actually copying
  the data when it is safe to do so. The exact circumstances under which a
  copy will or will not be performed are undocumented and subject to change.