8269130: Replace usages of Collection.toArray() with Collection.toArray(T[]) to avoid redundant array copying

Reviewed-by: mullan, serb
This commit is contained in:
Andrey Turbanov 2021-08-10 13:27:59 +00:00 committed by Jayathirth D V
parent 2b05fae155
commit 35b399aca8
8 changed files with 16 additions and 70 deletions

View file

@ -653,14 +653,7 @@ public final class Security {
if (candidates == null || candidates.isEmpty())
return null;
Object[] candidatesArray = candidates.toArray();
Provider[] result = new Provider[candidatesArray.length];
for (int i = 0; i < result.length; i++) {
result[i] = (Provider)candidatesArray[i];
}
return result;
return candidates.toArray(new Provider[0]);
}
// Map containing cached Spi Class objects of the specified type