code: public static <R> ImmutableGrid<R> copyOf(int rowCount, int columnCount, Iterable<? extends Cell<R>> cells) {
          if (cells == null) {
              throw new IllegalArgumentException("Cells must not be null");
          }
          if (!cells.iterator().hasNext()) {
              return new EmptyGrid<R>(rowCount, columnCount);
          }
          return new SparseImmutableGrid<R>(rowCount, columnCount, cells);
      }
docs: Obtains an immutable grid by copying a set of cells.
  
  @param <R> the type of the value
  @param rowCount  the number of rows, zero or greater
  @param columnCount  the number of columns, zero or greater
  @param cells  the cells to copy, not null
  @return the immutable grid, not null
  @throws IndexOutOfBoundsException if either index is less than zero