Here you can find the source of toString(final List
private static String toString(final List<String> input)
//package com.java2s; /******************************************************************************* * Copyright (c) 2015 Red Hat.// w w w. jav a2s .com * 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: * Red Hat - Initial Contribution *******************************************************************************/ import java.util.Iterator; import java.util.List; public class Main { private static String toString(final List<String> input) { final StringBuilder command = new StringBuilder(); for (Iterator<String> iterator = input.iterator(); iterator.hasNext();) { String fragment = iterator.next(); command.append(fragment); if (iterator.hasNext()) { command.append(" "); } } return command.toString(); } }