Revert "Doesn't use a Java 1.8 Method to sort KeyframeList's contents"

This reverts commit 7c342d8995fdcb103a9eb01e57efad15af66b427.
This commit is contained in:
CrushedPixel
2015-07-10 14:14:54 +02:00
parent 1c417877e6
commit 8aec0a364a

View File

@@ -1,11 +1,10 @@
package eu.crushedpixel.replaymod.interpolation; package eu.crushedpixel.replaymod.interpolation;
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
import eu.crushedpixel.replaymod.holders.Keyframe; import eu.crushedpixel.replaymod.holders.Keyframe;
import eu.crushedpixel.replaymod.holders.KeyframeComparator; import eu.crushedpixel.replaymod.holders.KeyframeComparator;
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>> { public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>> {
@@ -45,7 +44,7 @@ public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>
public void sort() { public void sort() {
previousCallLinear = null; previousCallLinear = null;
Collections.sort(this, KEYFRAME_COMPARATOR); sort(KEYFRAME_COMPARATOR);
} }
/** /**
@@ -139,8 +138,6 @@ public class KeyframeList<K extends KeyframeValue> extends ArrayList<Keyframe<K>
} }
public K getInterpolatedValueForPathPosition(float pathPosition, boolean linear) { public K getInterpolatedValueForPathPosition(float pathPosition, boolean linear) {
//as every implementation of KeyframeValue returns a new instance of itself, this warning can be ignored
@SuppressWarnings("unchecked")
K toApply = (K)first().getValue().newInstance(); K toApply = (K)first().getValue().newInstance();
if(previousCallLinear != (Boolean)linear) { if(previousCallLinear != (Boolean)linear) {