On Tue, 16 Nov 2021 10:36:46 GMT, Glavo <d...@openjdk.java.net> wrote:
>> src/java.base/share/classes/java/lang/runtime/ObjectMethods.java line 264: >> >>> 262: .map(g -> g.type().returnType()) >>> 263: .toList() >>> 264: .toArray(new Class<?>[getters.length]); >> >> Why not `new Class[0]`? It's likely to be faster, isn't it? > > (I'm not reviewer.) > > I think `.toArray(Class<?>[]::new)` should be better here. `.toList` seems > unnecessary. Class<?>[] types = Stream.of(getters) .map(g -> g.type().returnType()) .toArray(Class<?>[]::new); ------------- PR: https://git.openjdk.java.net/jdk/pull/6403