Factor out addAll(String[], List<String>).

This commit is contained in:
Michael Bayne
2015-11-29 16:57:35 -08:00
parent 942d55a18b
commit 197d3e6620
@@ -624,32 +624,20 @@ public class Application
// transfer our JVM arguments // transfer our JVM arguments
String[] jvmargs = ConfigUtil.getMultiValue(cdata, "jvmarg"); String[] jvmargs = ConfigUtil.getMultiValue(cdata, "jvmarg");
if (jvmargs != null) { addAll(jvmargs, _jvmargs);
for (String jvmarg : jvmargs) {
_jvmargs.add(jvmarg);
}
}
// Add the launch specific JVM arguments // Add the launch specific JVM arguments
for (String arg : _extraJvmArgs) { addAll(_extraJvmArgs, _jvmargs);
_jvmargs.add(arg);
}
// get the set of optimum JVM arguments // get the set of optimum JVM arguments
_optimumJvmArgs = ConfigUtil.getMultiValue(cdata, "optimum_jvmarg"); _optimumJvmArgs = ConfigUtil.getMultiValue(cdata, "optimum_jvmarg");
// transfer our application arguments // transfer our application arguments
String[] appargs = ConfigUtil.getMultiValue(cdata, prefix + "apparg"); String[] appargs = ConfigUtil.getMultiValue(cdata, prefix + "apparg");
if (appargs != null) { addAll(appargs, _appargs);
for (String apparg : appargs) {
_appargs.add(apparg);
}
}
// add the launch specific application arguments // add the launch specific application arguments
for (String arg : _extraAppArgs) { addAll(_extraAppArgs, _appargs);
_appargs.add(arg);
}
// look for custom arguments // look for custom arguments
fillAssignmentListFromPairs("extra.txt", _txtJvmArgs); fillAssignmentListFromPairs("extra.txt", _txtJvmArgs);
@@ -1568,6 +1556,15 @@ public class Application
return (rect == null) ? def : rect; return (rect == null) ? def : rect;
} }
/** Helper function to add all values in {@code values} (if non-null) to {@code target}. */
protected static void addAll (String[] values, List<String> target) {
if (values != null) {
for (String value : values) {
target.add(value);
}
}
}
/** /**
* Make an immutable List from the specified int array. * Make an immutable List from the specified int array.
*/ */