Java List Join joinList(List list, String glue)

Here you can find the source of joinList(List list, String glue)

Description

join List

License

Apache License

Declaration

private static String joinList(List<String> list, String glue) 

Method Source Code

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

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

public class Main {
    private static String joinList(List<String> list, String glue) {
        Iterator<String> i = list.iterator();
        if (i.hasNext() == false) {
            return "";
        }//  ww  w  .j a  v a  2s .  c om
        StringBuffer res = new StringBuffer();
        res.append(i.next());
        while (i.hasNext()) {
            res.append(glue + i.next());
        }
        return res.toString();
    }
}

Related

  1. joinList(final List list)
  2. joinList(final List list, final String sep)
  3. joinList(List list, String separator)
  4. joinList(List list, String separator)
  5. joinList(List items)
  6. joinList(List list, String separator)
  7. joinList(List parts, String sep)
  8. joinList(String separater, List list)
  9. joinLists( final List> lists)