Update JVMHelper.java

Optimized "for" loop
This commit is contained in:
Anatoliy 2018-12-05 21:56:15 +02:00 committed by Gravit
parent 1b516ccf2f
commit e7846adaf2

View file

@ -100,16 +100,15 @@ public static String[] getClassPath() {
public static URL[] getClassPathURL() { public static URL[] getClassPathURL() {
String[] cp = System.getProperty("java.class.path").split(File.pathSeparator); String[] cp = System.getProperty("java.class.path").split(File.pathSeparator);
URL[] list = new URL[cp.length]; URL[] list = new URL[cp.length];
int it = 0;
for (String s : cp) { for(int i = 0; i < cp.length; i++) {
URL url = null; URL url = null;
try { try {
url = new URL(s); url = new URL(cp[i]);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
e.printStackTrace(); e.printStackTrace();
} }
list[it] = url; list[i] = url;
it++;
} }
return list; return list;
} }