Skip to content

Commit 11ad173

Browse files
author
Andrey Turbanov
committed
8354944: Remove unnecessary PartiallyOrderedSet.nodes
Reviewed-by: serb, aivanov
1 parent 4755276 commit 11ad173

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/java.desktop/share/classes/javax/imageio/spi/PartiallyOrderedSet.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
3030
import java.util.Iterator;
3131
import java.util.LinkedList;
3232
import java.util.Map;
33-
import java.util.Set;
3433

3534
/**
3635
* A set of {@code Object}s with pairwise orderings between them.
@@ -58,22 +57,19 @@ class PartiallyOrderedSet<E> extends AbstractSet<E> {
5857
// p. 315.
5958

6059
// Maps Objects to DigraphNodes that contain them
61-
private Map<E, DigraphNode<E>> poNodes = new HashMap<>();
62-
63-
// The set of Objects
64-
private Set<E> nodes = poNodes.keySet();
60+
private final Map<E, DigraphNode<E>> poNodes = new HashMap<>();
6561

6662
/**
6763
* Constructs a {@code PartiallyOrderedSet}.
6864
*/
6965
public PartiallyOrderedSet() {}
7066

7167
public int size() {
72-
return nodes.size();
68+
return poNodes.size();
7369
}
7470

7571
public boolean contains(Object o) {
76-
return nodes.contains(o);
72+
return poNodes.containsKey(o);
7773
}
7874

7975
/**
@@ -90,7 +86,7 @@ public Iterator<E> iterator() {
9086
* {@code PartiallyOrderedSet}.
9187
*/
9288
public boolean add(E o) {
93-
if (nodes.contains(o)) {
89+
if (poNodes.containsKey(o)) {
9490
return false;
9591
}
9692

0 commit comments

Comments
 (0)