private void sortUnitsToMove(final List<Unit> units,final Route route){
  if (units == null || units.isEmpty()) {
    return;
  }
 else   if (route == null) {
    final Exception nullRouteError=(new IllegalArgumentException("route is not supposed to be null"));
    ClientLogger.logQuietly("Programming error, route should not be null here. Aborting sort operation and returning.",nullRouteError);
  }
  final Comparator<Unit> unitComparator;
  if (route.isUnload() && Match.someMatch(units,Matches.UnitIsLand)) {
    unitComparator=UnitComparator.getUnloadableUnitsComparator(units,route,getUnitOwner(units));
  }
 else {
    unitComparator=UnitComparator.getMovableUnitsComparator(units,route);
  }
  Collections.sort(units,unitComparator);
}

private void sortUnitsToMove ( final List < Unit > units , final Route route ) { if ( units == null || units . isEmpty ( ) ) { return ; } else if ( route == null ) { final Exception nullRouteError = ( new IllegalArgumentException ( "route is not supposed to be null" ) ) ; ClientLogger . logQuietly ( "Programming error, route should not be null here. Aborting sort operation and returning." , nullRouteError ) ; } final Comparator < Unit > unitComparator ; if ( route . isUnload ( ) && Match . someMatch ( units , Matches . UnitIsLand ) ) { unitComparator = UnitComparator . getUnloadableUnitsComparator ( units , route , getUnitOwner ( units ) ) ; } else { unitComparator = UnitComparator . getMovableUnitsComparator ( units , route ) ; } Collections . sort ( units , unitComparator ) ; }
sort the specified units in preferred movement or unload order .
