Java List Union unionSeparator(List elements, String separator)

Here you can find the source of unionSeparator(List elements, String separator)

Description

union Separator

License

Open Source License

Declaration

public static String unionSeparator(List<String> elements, String separator) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static String unionSeparator(List<String> elements, String separator) {
        final StringBuilder sb = new StringBuilder();

        sb.append(elements.get(0));//from  ww w .  j a  va2s .c om
        for (int i = 1; i < elements.size(); i++) {
            sb.append(separator);
            sb.append(elements.get(i));
        }

        return sb.toString();
    }
}

Related

  1. unionCreditList(List list)
  2. unionList( Collection col1, Collection col2)
  3. unionList(List la, List lb)
  4. unionList(List list1, List list2)
  5. unionOfListOfLists( final Collection> collectionOfCollection)