On Sun, 4 Jul 2021 20:42:41 GMT, Andrey Turbanov 
<github.com+741251+turban...@openjdk.org> wrote:

> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to 
> use `ArrayList` if a thread-safe implementation is not needed. In 
> post-BiasedLocking times, this is gets worse, as every access is synchronized.
> I checked only places where `Vector` was used as local variable.

src/java.desktop/share/classes/java/awt/MenuBar.java line 348:

> 346:             Iterator<MenuShortcut> e = getMenu(i).shortcuts();
> 347:             while (e.hasNext()) {
> 348:                 shortcuts.addElement(e.next());

I think it is fine to replace the Enumeration with the Iterator in most of the 
places, but here we will get a kind of mix of both, since we cannot remove the 
usage of Enumeration in the return time.

src/java.desktop/share/classes/javax/print/MimeType.java line 576:

> 574:         ArrayList<String> thePieces = new ArrayList<>();
> 575:         boolean mediaTypeIsText;
> 576:         boolean parameterNameIsCharset;

Default values might be removed as a separate cleanup.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4680

Reply via email to