RFR: 8258804: Collection.toArray() should use empty array

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Tue Dec 22 00:02:03 UTC 2020


Comparing to Collection.toArray(new T[size)), he Collection.toArray(new T[0]) seems faster, safer and contractually cleaner.  In the update, the use of Collection.toArray(new T[size)) in the SunJSSE provider implementation is replaced with Collection.toArray(new T[0]).

Bug: https://bugs.openjdk.java.net/browse/JDK-8258804

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

Commit messages:
 - 8258804: Collection.toArray() should use empty array

Changes: https://git.openjdk.java.net/jdk/pull/1861/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1861&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8258804
  Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1861.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1861/head:pull/1861

PR: https://git.openjdk.java.net/jdk/pull/1861



More information about the security-dev mailing list