Java List Concatenate concatenate(List contents, String separator)

Here you can find the source of concatenate(List contents, String separator)

Description

concatenate

License

Apache License

Declaration

public static <T> String concatenate(List<T> contents, String separator) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

public class Main {
    public static <T> String concatenate(List<T> contents, String separator) {
        if (contents == null || contents.isEmpty())
            return null;

        String concatenation = "";

        for (Object content : contents) {
            concatenation += content.toString() + separator;
        }/* ww  w  .jav a  2 s .c o m*/

        return concatenation.substring(0, concatenation.length() - separator.length());
    }
}

Related

  1. concatenate(List components)
  2. concatenate(List list)
  3. concatenate(List strings)
  4. concatenate(List xs)
  5. concatenate(List a, List b)
  6. concatenate(List... lists)
  7. concatenate(String[] selectors, List lessExtends)
  8. concatenateFileContent(List fileContents)
  9. ConcatenateInt(List arrays)