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