On Thu, 16 May 2024 03:31:05 GMT, Chen Liang <li...@openjdk.org> wrote:
>> Ioi Lam has updated the pull request incrementally with one additional >> commit since the last revision: >> >> (1) comments from @liach; (2) added javadoc; (3) Use >> createTestJavaProcessBuilder() instead of >> createLimitedTestJavaProcessBuilder() > > test/lib/jdk/test/lib/StringArrayUtils.java line 42: > >> 40: } >> 41: >> 42: return list.toArray(new String[list.size()]); > > I thought we have been preferring ot use `new String[0]` for toArray calls. > Also for simplicity, we can change the implementation to: > > var list = new ArrayList<>(Arrays.asList(prefix)); > Collections.addAll(list, extra); > return list.toArray(new String[0]); > > or for performance: > > String[] ret = new String[prefix.length + extra.length]; > System.arraycopy(prefix, 0, ret, 0, prefix.length); > System.arraycopy(extra, 0, ret, prefix.length, extra.length); > return ret; Thanks for the suggestion. I used your `arraycopy` version. I also added some javadocs about the intended use of these `concat()` methods. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19256#discussion_r1603781994