Java List Merge merge(List list)

Here you can find the source of merge(List list)

Description

merge

License

Open Source License

Declaration

public static String merge(List<String> list) 

Method Source Code

//package com.java2s;
/* (c) 2014 Open Source Geospatial Foundation - all rights reserved
 * (c) 2001 - 2013 OpenPlans//from   w  ww.j a va2 s . co m
 * This code is licensed under the GPL 2.0 license, available at the root
 * application directory.
 */

import java.util.Iterator;
import java.util.List;

public class Main {
    public static String merge(List<String> list) {
        return merge(list, ",");
    }

    public static String merge(List<String> list, String separator) {
        StringBuilder sb = new StringBuilder();
        for (Iterator<String> it = list.iterator(); it.hasNext();) {
            String string = it.next();
            sb.append(string);
            if (it.hasNext()) {
                sb.append(separator);
            }
        }
        return sb.toString();
    }
}

Related

  1. merge(List left, List right)
  2. merge(List list1, List list2)
  3. merge(List> list)
  4. merge(List l1, List l2)
  5. merge(List l1, List l2)
  6. merge(List lst1, List lst2)
  7. merge(List stringList)
  8. merge(List text)
  9. merge(List a, List b)