LinkedList is used as value in 
`sun.jvm.hotspot.runtime.ConcurrentLocksPrinter#locksMap` Map.
There is only add/iterator calls on this lists. No removes from the head or 
something like this. Not sure why LinkedList was used, but ArrayList should be 
preferred as more efficient and widely used collection.

Also I've done some related code cleaned:
1. Mark field `locksMap` as final
2. Use Map.computeIfAbsent
3. Use enhanced-for cycle instead of `for` with iterator

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

Commit messages:
 - [PATCH] Prefer ArrayList to LinkedList in ConcurrentLocksPrinter

Changes: https://git.openjdk.org/jdk/pull/12763/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12763&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8303267
  Stats: 10 lines in 1 file changed: 0 ins; 5 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/12763.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12763/head:pull/12763

PR: https://git.openjdk.org/jdk/pull/12763

Reply via email to