List<String> (@NotNull List<String> cmdline) { final List<String> safeCommand = new ArrayList<>(cmdline); for (int i = 0; i < safeCommand.size(); i++) { if (cmdline.get(i).equals("--proxy") && i + 1 < cmdline.size()) { safeCommand.set(i + 1, makeSafeUrlArgument(cmdline.get(i + 1))); } if (cmdline.get(i).equals("--index-url") && i + 1 < cmdline.size()) { safeCommand.set(i + 1, makeSafeUrlArgument(cmdline.get(i + 1))); } } return safeCommand; }