use List interface instead of ArrayList implementation in several places
This commit is contained in:
@@ -1,18 +1,24 @@
|
|||||||
package eu.crushedpixel.replaymod.assets;
|
package eu.crushedpixel.replaymod.assets;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class CustomObjectRepository {
|
public class CustomObjectRepository {
|
||||||
|
|
||||||
public CustomObjectRepository() {
|
public CustomObjectRepository() {
|
||||||
this.objects = new ArrayList<CustomImageObject>();
|
this.objects = new ArrayList<CustomImageObject>();
|
||||||
}
|
}
|
||||||
|
public CustomObjectRepository(List<CustomImageObject> objects) {
|
||||||
|
setObjects(objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjects(List<CustomImageObject> objects) {
|
||||||
|
this.objects = new ArrayList<CustomImageObject>(objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Getter
|
||||||
private ArrayList<CustomImageObject> objects;
|
private ArrayList<CustomImageObject> objects;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import org.lwjgl.util.Point;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -363,7 +362,7 @@ public class GuiObjectManager extends GuiScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveOnQuit() {
|
private void saveOnQuit() {
|
||||||
ArrayList<CustomImageObject> objects = objectList.getCopyOfElements();
|
List<CustomImageObject> objects = objectList.getCopyOfElements();
|
||||||
ReplayHandler.setCustomImageObjects(objects);
|
ReplayHandler.setCustomImageObjects(objects);
|
||||||
|
|
||||||
if(objects.size() > 0) {
|
if(objects.size() > 0) {
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class GuiEntryList<T extends GuiEntryListEntry> extends GuiAdvancedTextFi
|
|||||||
fireSelectionChangeEvent();
|
fireSelectionChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<T> getCopyOfElements() {
|
public List<T> getCopyOfElements() {
|
||||||
return new ArrayList<T>(elements);
|
return new ArrayList<T>(elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -617,8 +617,8 @@ public class ReplayHandler {
|
|||||||
customImageObjects.getObjects().add(object);
|
customImageObjects.getObjects().add(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCustomImageObjects(ArrayList<CustomImageObject> objects) {
|
public static void setCustomImageObjects(List<CustomImageObject> objects) {
|
||||||
customImageObjects.setObjects(objects);
|
customImageObjects.setObjects(new ArrayList<CustomImageObject>(objects));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fireKeyframesModifyEvent() {
|
public static void fireKeyframesModifyEvent() {
|
||||||
|
|||||||
Reference in New Issue
Block a user