-
Enhancement
-
Resolution: Unresolved
-
P5
-
None
-
None
There are 2 similar blocks of code in sun.awt.X11GraphicsEnvironment#initDevices
devices.put(id, old.containsKey(id) ? old.remove(id) :
new X11GraphicsDevice(id));
and in sun.awt.CGraphicsEnvironment#initDevices:
devices.put(id, old.containsKey(id) ? old.remove(id)
: new CGraphicsDevice(id));
We can avoid redundant Map.containsKey calls. Instead of separate containsKey call we can call old.remove and then compare result with null.
devices.put(id, old.containsKey(id) ? old.remove(id) :
new X11GraphicsDevice(id));
and in sun.awt.CGraphicsEnvironment#initDevices:
devices.put(id, old.containsKey(id) ? old.remove(id)
: new CGraphicsDevice(id));
We can avoid redundant Map.containsKey calls. Instead of separate containsKey call we can call old.remove and then compare result with null.
- links to
-
Review(master) openjdk/jdk/24907