Replace Collections.sort with List.sort
This commit is contained in:
		
							parent
							
								
									7fd90efd3d
								
							
						
					
					
						commit
						eaf59aeb75
					
				| @ -58,7 +58,7 @@ public class ThrustCurveMotorSet implements Comparable<ThrustCurveMotorSet> { | |||||||
| 		if (!checkMotorOverwrite(motor)) { | 		if (!checkMotorOverwrite(motor)) { | ||||||
| 			motors.add(motor); | 			motors.add(motor); | ||||||
| 			digestMap.put(motor, motor.getDigest()); | 			digestMap.put(motor, motor.getDigest()); | ||||||
| 			Collections.sort(motors, comparator); | 			motors.sort(comparator); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -88,7 +88,7 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati | |||||||
| 					// TODO: Could something be computed in parallel? | 					// TODO: Could something be computed in parallel? | ||||||
| 					functionExecutor.compute(simplex); | 					functionExecutor.compute(simplex); | ||||||
| 					functionExecutor.waitFor(simplex); | 					functionExecutor.waitFor(simplex); | ||||||
| 					Collections.sort(simplex, comparator); | 					simplex.sort(comparator); | ||||||
| 					simplexComputed = true; | 					simplexComputed = true; | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| @ -126,7 +126,7 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati | |||||||
| 					simplex.clear(); | 					simplex.clear(); | ||||||
| 					simplex.add(current); | 					simplex.add(current); | ||||||
| 					simplex.addAll(reflection); | 					simplex.addAll(reflection); | ||||||
| 					Collections.sort(simplex, comparator); | 					simplex.sort(comparator); | ||||||
| 
 | 
 | ||||||
| 					if (useExpansion) { | 					if (useExpansion) { | ||||||
| 
 | 
 | ||||||
| @ -147,7 +147,7 @@ public class MultidirectionalSearchOptimizer implements FunctionOptimizer, Stati | |||||||
| 							simplex.add(current); | 							simplex.add(current); | ||||||
| 							simplex.addAll(expansion); | 							simplex.addAll(expansion); | ||||||
| 							step *= 2; | 							step *= 2; | ||||||
| 							Collections.sort(simplex, comparator); | 							simplex.sort(comparator); | ||||||
| 							expansionAcceptance++; | 							expansionAcceptance++; | ||||||
| 						} else { | 						} else { | ||||||
| 							log.debug("Expansion failed"); | 							log.debug("Expansion failed"); | ||||||
|  | |||||||
| @ -413,7 +413,7 @@ public class ComponentPreset implements Comparable<ComponentPreset>, Serializabl | |||||||
| 
 | 
 | ||||||
| 			List<TypedKey<?>> keys = new ArrayList<>(properties.keySet()); | 			List<TypedKey<?>> keys = new ArrayList<>(properties.keySet()); | ||||||
| 
 | 
 | ||||||
| 			Collections.sort(keys, new Comparator<>() { | 			keys.sort(new Comparator<>() { | ||||||
| 				@Override | 				@Override | ||||||
| 				public int compare(TypedKey<?> a, TypedKey<?> b) { | 				public int compare(TypedKey<?> a, TypedKey<?> b) { | ||||||
| 					return a.getName().compareTo(b.getName()); | 					return a.getName().compareTo(b.getName()); | ||||||
|  | |||||||
| @ -77,7 +77,7 @@ public class OpenRocketComponentSaver { | |||||||
|         // We're going to sort the initial data since that makes the output much easier |         // We're going to sort the initial data since that makes the output much easier | ||||||
|         // on the eyes. |         // on the eyes. | ||||||
| 
 | 
 | ||||||
|         Collections.sort(theMaterialList, new Comparator<>() { |         theMaterialList.sort(new Comparator<>() { | ||||||
| 
 | 
 | ||||||
| 			@Override | 			@Override | ||||||
| 			public int compare(Material o1, Material o2) { | 			public int compare(Material o1, Material o2) { | ||||||
| @ -86,7 +86,7 @@ public class OpenRocketComponentSaver { | |||||||
| 
 | 
 | ||||||
| 		}); | 		}); | ||||||
| 
 | 
 | ||||||
|         Collections.sort(thePresetList, new Comparator<>() { |         thePresetList.sort(new Comparator<>() { | ||||||
| 
 | 
 | ||||||
| 			@Override | 			@Override | ||||||
| 			public int compare(ComponentPreset o1, ComponentPreset o2) { | 			public int compare(ComponentPreset o1, ComponentPreset o2) { | ||||||
|  | |||||||
| @ -303,7 +303,7 @@ public class MathUtil { | |||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		List<Number> sorted = new ArrayList<>(values); | 		List<Number> sorted = new ArrayList<>(values); | ||||||
| 		Collections.sort(sorted, new Comparator<>() { | 		sorted.sort(new Comparator<>() { | ||||||
| 			@Override | 			@Override | ||||||
| 			public int compare(Number o1, Number o2) { | 			public int compare(Number o1, Number o2) { | ||||||
| 				return Double.compare(o1.doubleValue(), o2.doubleValue()); | 				return Double.compare(o1.doubleValue(), o2.doubleValue()); | ||||||
|  | |||||||
| @ -402,7 +402,7 @@ public abstract class FinSetConfig extends RocketComponentConfig { | |||||||
| 		 | 		 | ||||||
| 		if (rings != null) { | 		if (rings != null) { | ||||||
| 			//Sort rings from top of parent to bottom | 			//Sort rings from top of parent to bottom | ||||||
| 			Collections.sort(rings, new Comparator<>() { | 			rings.sort(new Comparator<>() { | ||||||
| 				@Override | 				@Override | ||||||
| 				public int compare(CenteringRing centeringRing, CenteringRing centeringRing1) { | 				public int compare(CenteringRing centeringRing, CenteringRing centeringRing1) { | ||||||
| 					return (int) (1000d * (centeringRing.getAxialOffset(AxialMethod.TOP) - | 					return (int) (1000d * (centeringRing.getAxialOffset(AxialMethod.TOP) - | ||||||
|  | |||||||
| @ -581,7 +581,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec | |||||||
| 			motors = filtered; | 			motors = filtered; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		Collections.sort(motors, MOTOR_COMPARATOR); | 		motors.sort(MOTOR_COMPARATOR); | ||||||
| 
 | 
 | ||||||
| 		return motors; | 		return motors; | ||||||
| 	} | 	} | ||||||
| @ -665,7 +665,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec | |||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		// No motor has been used | 		// No motor has been used | ||||||
| 		Collections.sort(list, MOTOR_COMPARATOR); | 		list.sort(MOTOR_COMPARATOR); | ||||||
| 		return list.get(0); | 		return list.get(0); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -595,7 +595,7 @@ public class SimulationPlot { | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		Collections.sort(eventList, new Comparator<>() { | 		eventList.sort(new Comparator<>() { | ||||||
| 
 | 
 | ||||||
| 			@Override | 			@Override | ||||||
| 			public int compare(EventDisplayInfo o1, EventDisplayInfo o2) { | 			public int compare(EventDisplayInfo o1, EventDisplayInfo o2) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user