legacy/src/main/java/thredds/catalog/InvDatasetImpl.java
public void addDataset(int index, InvDatasetImpl ds) {
    if (ds == null) return;
    ds.setParent(this);
    datasets.add(index, ds);
    hashCode = 0;
  }
public void addDataset(int index, InvDatasetImpl ds) {
    if (ds == null) return;
    ds.setParent(this);
    datasets.add(index, ds);
    hashCode = 0;
  }
Add a nested dataset at the location indicated by index.

@param index add at this position
@param ds    add this