public static Set<ContainerModel> generateContainerModels(int numContainers,int taskCount){
  Set<ContainerModel> models=new HashSet<>(numContainers);
  int[] taskCountPerContainer=calculateTaskCountPerContainer(taskCount,numContainers);
  int j=0;
  for (int i=0; i < numContainers; i++) {
    int[] partitions=new int[taskCountPerContainer[i]];
    for (int k=0; k < taskCountPerContainer[i]; k++) {
      partitions[k]=j + k;
    }
    j+=taskCountPerContainer[i];
    models.add(createContainerModel(i,partitions));
  }
  return models;
}

public static Set < ContainerModel > generateContainerModels ( int numContainers , int taskCount ) { Set < ContainerModel > models = new HashSet < > ( numContainers ) ; int [ ] taskCountPerContainer = calculateTaskCountPerContainer ( taskCount , numContainers ) ; int j = 0 ; for ( int i = 0 ; i < numContainers ; i ++ ) { int [ ] partitions = new int [ taskCountPerContainer [ i ] ] ; for ( int k = 0 ; k < taskCountPerContainer [ i ] ; k ++ ) { partitions [ k ] = j + k ; } j += taskCountPerContainer [ i ] ; models . add ( createContainerModel ( i , partitions ) ) ; } return models ; }
note : this is artificial . it makes assumptions about task grouping , changelog partition mapping , etc . that will likely not be true at runtime , but are not the focus of this test .
