Java List to String toString(final List input)

Here you can find the source of toString(final List input)

Description

to String

License

Open Source License

Declaration

private static String toString(final List<String> input) 

Method Source Code

//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();
    }
}

Related

  1. listToString(String itemName, List list)
  2. toString(final List list)
  3. toString(final List list, final String separtor)
  4. toString(final List list)
  5. toString(final List inMessages)
  6. toString(final List list, char delimiter)
  7. toString(final Object[] list)
  8. toString(List arguments)
  9. toString(List l)