public final void reset(int[] dims){
  if (dims == null) {
    cells=null;
  }
 else {
    if (dims.length < 1) {
      throw new IllegalArgumentException("Table must have at " + "least one dimension.");
    }
    for (int i=0; i < dims.length; i++) {
      if (dims[i] < 1) {
        throw new IllegalArgumentException("Dimension " + i + " has fewer than "+ "one values: "+ dims[i]);
      }
    }
    this.numCells=1;
    for (    int dim : dims) {
      this.numCells*=dim;
    }
    cells=new HashMap<>();
    this.dims=new int[dims.length];
    System.arraycopy(dims,0,this.dims,0,dims.length);
  }
}

public final void reset ( int [ ] dims ) { if ( dims == null ) { cells = null ; } else { if ( dims . length < 1 ) { throw new IllegalArgumentException ( "Table must have at " + "least one dimension." ) ; } for ( int i = 0 ; i < dims . length ; i ++ ) { if ( dims [ i ] < 1 ) { throw new IllegalArgumentException ( "Dimension " + i + " has fewer than " + "one values: " + dims [ i ] ) ; } } this . numCells = 1 ; for ( int dim : dims ) { this . numCells *= dim ; } cells = new HashMap < > ( ) ; this . dims = new int [ dims . length ] ; System . arraycopy ( dims , 0 , this . dims , 0 , dims . length ) ; } }
resets the table , allowing a different dimensionality . all cells are reset to zero . the underlying data array is reused if possible .
