Replace Collections.sort with List.sort

This commit is contained in:
SiboVG 2024-08-09 05:18:08 +02:00
parent 7fd90efd3d
commit eaf59aeb75
8 changed files with 12 additions and 12 deletions

View File

@ -58,7 +58,7 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> {
if (!checkMotorOverwrite(motor)) {
motors.add(motor);
digestMap.put(motor, motor.getDigest());
Collections.sort(motors, comparator);
motors.sort(comparator);
}
}

View File

@ -88,7 +88,7 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati
// TODO: Could something be computed in parallel?
functionExecutor.compute(simplex);
functionExecutor.waitFor(simplex);
Collections.sort(simplex, comparator);
simplex.sort(comparator);
simplexComputed = true;
}
@ -126,7 +126,7 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati
simplex.clear();
simplex.add(current);
simplex.addAll(reflection);
Collections.sort(simplex, comparator);
simplex.sort(comparator);
if (useExpansion) {
@ -147,7 +147,7 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati
simplex.add(current);
simplex.addAll(expansion);
step *= 2;
Collections.sort(simplex, comparator);
simplex.sort(comparator);
expansionAcceptance++;
} else {
log.debug("Expansion failed");

View File

@ -413,7 +413,7 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl
List<TypedKey<?>> keys = new ArrayList<>(properties.keySet());
Collections.sort(keys, new Comparator<>() {
keys.sort(new Comparator<>() {
@Override
public int compare(TypedKey<?> a, TypedKey<?> b) {
return a.getName().compareTo(b.getName());

View File

@ -77,7 +77,7 @@ public class OpenRocketComponentSaver {
// We're going to sort the initial data since that makes the output much easier
// on the eyes.
Collections.sort(theMaterialList, new Comparator<>() {
theMaterialList.sort(new Comparator<>() {
@Override
public int compare(Material o1, Material o2) {
@ -86,7 +86,7 @@ public class OpenRocketComponentSaver {
});
Collections.sort(thePresetList, new Comparator<>() {
thePresetList.sort(new Comparator<>() {
@Override
public int compare(ComponentPreset o1, ComponentPreset o2) {

View File

@ -303,7 +303,7 @@ public class MathUtil {
}
List<Number> sorted = new ArrayList<>(values);
Collections.sort(sorted, new Comparator<>() {
sorted.sort(new Comparator<>() {
@Override
public int compare(Number o1, Number o2) {
return Double.compare(o1.doubleValue(), o2.doubleValue());

View File

@ -402,7 +402,7 @@ public abstract class FinSetConfig extends RocketComponentConfig {
if (rings != null) {
//Sort rings from top of parent to bottom
Collections.sort(rings, new Comparator<>() {
rings.sort(new Comparator<>() {
@Override
public int compare(CenteringRing centeringRing, CenteringRing centeringRing1) {
return (int) (1000d * (centeringRing.getAxialOffset(AxialMethod.TOP) -

View File

@ -581,7 +581,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
motors = filtered;
}
Collections.sort(motors, MOTOR_COMPARATOR);
motors.sort(MOTOR_COMPARATOR);
return motors;
}
@ -665,7 +665,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
}
// No motor has been used
Collections.sort(list, MOTOR_COMPARATOR);
list.sort(MOTOR_COMPARATOR);
return list.get(0);
}

View File

@ -595,7 +595,7 @@ public class SimulationPlot {
}
}
Collections.sort(eventList, new Comparator<>() {
eventList.sort(new Comparator<>() {
@Override
public int compare(EventDisplayInfo o1, EventDisplayInfo o2) {