public static PackingPlan.ContainerPlan[] sortOnContainerId(Set<PackingPlan.ContainerPlan> containers){
  ArrayList<Integer> containerIds=new ArrayList<>();
  PackingPlan.ContainerPlan[] currentContainers=new PackingPlan.ContainerPlan[containers.size()];
  for (  PackingPlan.ContainerPlan container : containers) {
    containerIds.add(container.getId());
  }
  Collections.sort(containerIds);
  for (  PackingPlan.ContainerPlan container : containers) {
    int position=containerIds.indexOf(container.getId());
    currentContainers[position]=container;
  }
  return currentContainers;
}

public static PackingPlan . ContainerPlan [ ] sortOnContainerId ( Set < PackingPlan . ContainerPlan > containers ) { ArrayList < Integer > containerIds = new ArrayList < > ( ) ; PackingPlan . ContainerPlan [ ] currentContainers = new PackingPlan . ContainerPlan [ containers . size ( ) ] ; for ( PackingPlan . ContainerPlan container : containers ) { containerIds . add ( container . getId ( ) ) ; } Collections . sort ( containerIds ) ; for ( PackingPlan . ContainerPlan container : containers ) { int position = containerIds . indexOf ( container . getId ( ) ) ; currentContainers [ position ] = container ; } return currentContainers ; }
sort the container plans based on the container ids
