Here you can find the source of implode(List
public static String implode(List<String> tokens, char separator, char escapeCharacter)
//package com.java2s; /*//from w w w . ja v a 2 s . com * Copyright (c) 2014, 2015 Eike Stepper (Berlin, Germany) and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Eike Stepper - initial API and implementation * Yatta Solutions - [466264] Enhance UX in simple installer */ import java.util.List; public class Main { public static String implode(List<String> tokens, char separator) { return implode(tokens, separator, '\\'); } public static String implode(List<String> tokens, char separator, char escapeCharacter) { String escapeString = Character.toString(escapeCharacter); String escapeString2 = escapeString + escapeString; String separatorString = Character.toString(separator); String separatorString2 = escapeString + separatorString; StringBuilder builder = new StringBuilder(); boolean firstTime = true; for (String token : tokens) { if (firstTime) { firstTime = false; } else { builder.append(separator); } if (token != null) { token = token.replace(escapeString, escapeString2); token = token.replace(separatorString, separatorString2); builder.append(token); } } return builder.toString(); } }