On Fri, 26 Feb 2021 10:48:33 GMT, Сергей Цыпанов <github.com+10835776+stsypa...@openjdk.org> wrote:
> The usage of `LinkedList` is senseless and can be replaced with either > `ArrayList` or `ArrayDeque` which are both more compact and effective. > > jdk:tier1 and jdk:tier2 are both ok I don't remember all the comments you have received in this thread but have you verified that arbitrarily changing `LinkedList` into `ArrayList` in these classes is not going to significantly increase the footprint in the case where lists are empty or contain only one or two elements? I am not convinced that a global replacement of `LinkedList` by `ArrayList` is necessarily good - even though I agree that `ArrayList` is generally more efficient. src/java.base/share/classes/jdk/internal/util/jar/JarIndex.java line 155: > 153: */ > 154: public List<String> get(String fileName) { > 155: ArrayList<String> jarFiles; This could probably be declared as: List<String> jarFiles; src/java.base/share/classes/jdk/internal/util/jar/JarIndex.java line 264: > 262: String jar = jarFiles[i]; > 263: bw.write(jar + "\n"); > 264: ArrayList<String> jarlist = jarMap.get(jar); Here again, jarList could probably be declared as `List<String>` ------------- PR: https://git.openjdk.java.net/jdk/pull/2744