RFR: 8305538: Avoid redundant HashMap.containsKey call in ModuleDescriptor.Builder

Alan Bateman alanb at openjdk.org
Tue Apr 4 14:00:17 UTC 2023


On Tue, 4 Apr 2023 12:37:15 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> Seems we can update `java.lang.module.ModuleDescriptor.Builder#uses` too to directly call `add` instead of `contains`+`add`

If you are changing uses(String) then it should obey `strict`, meaning put this at the beginning of the method


if (strict) {
    requireServiceTypeName(service);
}

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

PR Comment: https://git.openjdk.org/jdk/pull/13288#issuecomment-1496022557


More information about the core-libs-dev mailing list