code: public boolean isValid() {
          int totalNumberOfColumns = 0;
          Set<Object> columns = new HashSet<>();
          for(Map.Entry<Object, AssociativeArray> entry : internalData.entrySet()) {
              AssociativeArray row = entry.getValue();
              if(columns.isEmpty()) {
                  //this is executed only for the first row
                  for(Object column : row.internalData.keySet()) {
                      columns.add(column);
                  }
                  totalNumberOfColumns = columns.size();
              }
              else {
                  //validating the columns of next rows based on first column
                  if(totalNumberOfColumns!=row.size()) {
                      return false; //if the number of rows do not much then it is invalid
                  }
                  
                  for(Object column : columns) {
                      if(row.containsKey(column)==false) {
                          return false; //if one of the detected columns do not exist, it is invalid
                      }
                  }
              }
          }
          return true;
      }
docs: Returns if the DataTable2D is valid. This data structure is considered
  valid it all the DataTable cells are set and as a result the DataTable
  has a rectangular format.
  
  @return