Replace ArrayList with List.copyOf in getFutureEventList method for improved immutability

This commit is contained in:
2025-02-14 15:46:29 +01:00
parent fbd1fab9fb
commit 64e135810a

View File

@@ -1,6 +1,5 @@
package net.berack.upo.valpre.sim;
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
@@ -151,7 +150,7 @@ public final class Simulation {
* @return a list of future events.
*/
public List<Event> getFutureEventList() {
return new ArrayList<>(this.fel);
return List.copyOf(this.fel);
}
/**