Java List Concatenate concatenate(List strings)

Here you can find the source of concatenate(List strings)

Description

Concatenate a list with items separated with a space.

License

Open Source License

Parameter

Parameter Description
strings list to concatenate

Return

concatenated list

Declaration

public static String concatenate(List<String> strings) 

Method Source Code

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

Related

  1. concatenate(List aList)
  2. concatenate(List> lists)
  3. concatenate(List list1, List list2)
  4. concatenate(List components)
  5. concatenate(List list)
  6. concatenate(List xs)
  7. concatenate(List a, List b)
  8. concatenate(List contents, String separator)
  9. concatenate(List... lists)

  10. HOME | Copyright © www.java2s.com 2016