# UNDF: UNDF-2026-000000072 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobGraph.java @@ -117,8 +117,8 @@ - /** Set of JAR files required to run this job. */ - private final List userJars = new ArrayList(); + /** Set of JAR files required to run this job (LinkedHashSet for O(1) dedup). */ + private final LinkedHashSet userJars = new LinkedHashSet<>(); - /** Set of blob keys identifying the JAR files required to run this job. */ - private final List userJarBlobKeys = new ArrayList<>(); + /** Set of blob keys identifying the JAR files required to run this job (LinkedHashSet for O(1) dedup). */ + private final LinkedHashSet userJarBlobKeys = new LinkedHashSet<>(); @@ -563,9 +563,7 @@ public void addJar(Path jar) { if (jar == null) { throw new IllegalArgumentException(); } - if (!userJars.contains(jar)) { - userJars.add(jar); - } + userJars.add(jar); } @@ -631,9 +629,7 @@ public void addUserJarBlobKey(PermanentBlobKey key) { if (key == null) { throw new IllegalArgumentException(); } - if (!userJarBlobKeys.contains(key)) { - userJarBlobKeys.add(key); - } + userJarBlobKeys.add(key); } @@ -596,3 +594,3 @@ public List getUserJars() { - return userJars; + return new ArrayList<>(userJars); } @@ -656,3 +654,3 @@ public List getUserJarBlobKeys() { - return this.userJarBlobKeys; + return new ArrayList<>(userJarBlobKeys); }