On Fri, 28 Oct 2022 21:51:03 GMT, Justin Lu <d...@openjdk.org> wrote:
> Issue: Duplication of methods between Basic*.java test classes, due to auto > generation by genBasic.sh > > Fix: Reorganize parts of Basic-X.java.template into base class in Basic.java. > Toggled -nel flag for generation script (genBasic.sh) to remove excessive > white space. Moved a previous direct change to BasicDateTime.java into the > template. > > Note: Main files to look at are Basic.java and Basic-X.java.template, as the > rest are a reflection of the auto generation test/jdk/java/util/Formatter/Basic-X.java.template line 1608: > 1606: // time zone ID. See JDK-8254865. > 1607: final List<String> list = new ArrayList<String>(); > 1608: Collections.addAll(list, ids); I think final List<String> list = new ArrayList<>(Arrays.asList(ids)); is going to be faster than final List<String> list = new ArrayList<String>(); Collections.addAll(list, ids); Alternatively you can contruct presized ArrayList. test/jdk/java/util/Formatter/Basic-X.java.template line 1612: > 1610: list.remove("America/WhiteHorse"); > 1611: list.remove("Canada/Yukon"); > 1612: ids = list.toArray(new String[list.size()]); ids = list.toArray(new String[0]); is likely to be faster, see https://shipilev.net/blog/2016/arrays-wisdom-ancients/ ------------- PR: https://git.openjdk.org/jdk/pull/10910