Here you can find the source of join(List
private static List<String> join(List<String> command, List<String> args)
//package com.java2s; import java.util.*; public class Main { private static List<String> join(List<String> command, List<String> args) { try {//from w w w. j a va2 s. c o m args.addAll(0, command); return args; } catch (Exception e) { ArrayList<String> commands = new ArrayList<String>(args.size() + command.size()); commands.addAll(command); commands.addAll(args); return commands; } } static String join(List<String> runCommand, String del) { if (runCommand.size() == 0) return ""; StringBuilder b = new StringBuilder(runCommand.get(0)); for (int i = 1; i < runCommand.size(); ++i) { b.append(del).append(runCommand.get(i)); } return b.toString(); } }