Skip to content

Commit e557b69

Browse files
author
Andrey Turbanov
committed
8356843: Avoid redundant HashMap.get to obtain old value in Toolkit.setDesktopProperty
Reviewed-by: aivanov, serb
1 parent dc881ee commit e557b69

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/java.desktop/share/classes/java/awt/Toolkit.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1995, 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
@@ -1472,8 +1472,7 @@ protected final void setDesktopProperty(String name, Object newValue) {
14721472
Object oldValue;
14731473

14741474
synchronized (this) {
1475-
oldValue = desktopProperties.get(name);
1476-
desktopProperties.put(name, newValue);
1475+
oldValue = desktopProperties.put(name, newValue);
14771476
}
14781477

14791478
// Don't fire change event if old and new values are null.

0 commit comments

Comments
 (0)