Integrated: 8303267: Prefer ArrayList to LinkedList in ConcurrentLocksPrinter

Andrey Turbanov aturbanov at openjdk.org
Thu Mar 2 18:43:19 UTC 2023


On Mon, 27 Feb 2023 12:54:24 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> 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

This pull request has now been integrated.

Changeset: d4dcba04
Author:    Andrey Turbanov <aturbanov at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d4dcba04632f07555e4fe5547ee39125935a03c6
Stats:     10 lines in 1 file changed: 0 ins; 5 del; 5 mod

8303267: Prefer ArrayList to LinkedList in ConcurrentLocksPrinter

Reviewed-by: cjplummer, sspitsyn

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

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


More information about the serviceability-dev mailing list