Use a set instead of a map to record methods in class `MethodGroup`

Guoxiong Li lgxbslgx at gmail.com
Wed Sep 21 01:48:27 UTC 2022


Hi all,

I notice there is a field `Map<MethodInvocation, MethodInvocation> methods`
in the class `org.openjdk.jmh.generators.core.MethodGroup`.
It is used to record all the methods of one group and
the key and value of one entry of the map is always the same.
>From the program's meaning, I think it is good to use a set instead of a
map.
And this implementation confused the newbie, like me,
so that I needed more time to read the related code to confirm its meaning.

So I propose to change it from a map to a set.
I know the `TreeSet` is implemented by using a `TreeMap` internally,
but it is clearer about the program's meaning by using a set.

What do you think about it? Any ideas are appreciated.

Best Regards,
-- Guoxiong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jmh-dev/attachments/20220921/94b98000/attachment.htm>


More information about the jmh-dev mailing list