[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: RFR: 8303267: Prefer ArrayList to LinkedList in ConcurrentLocksPrinter
From:       Serguei Spitsyn <sspitsyn () openjdk ! org>
Date:       2023-02-28 7:00:01
Message-ID: hhXQwVIleQS-kexyNqoh92theYiRnxUuJk8kGlSh0PY=.e6726dd0-821e-498a-af77-2b804d985cd8 () github ! com
[Download RAW message or body]

On Mon, 27 Feb 2023 12:54:24 GMT, Andrey Turbanov <aturbanov@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

Looks good.
Thanks,
Serguei

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

Marked as reviewed by sspitsyn (Reviewer).

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic