Here you can find the source of concatenate(List
Parameter | Description |
---|---|
strings | list to concatenate |
public static String concatenate(List<String> strings)
//package com.java2s; /*// ww w. j av a 2 s . co m # Licensed Materials - Property of IBM # Copyright IBM Corp. 2015 */ import java.util.List; public class Main { /** * Concatenate a list with items separated with a space. * * @param strings list to concatenate * @return concatenated list */ public static String concatenate(List<String> strings) { // wish for java8 String.join() StringBuilder cmdsb = new StringBuilder(); for (String s : strings) { cmdsb.append(s); cmdsb.append(" "); } return cmdsb.toString(); } }