Android List Join join(List s, String delimiter)

Here you can find the source of join(List s, String delimiter)

Description

join

Declaration

public static String join(List<String> s, String delimiter) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static String join(List<String> s, String delimiter) {
        if (s == null || s.isEmpty()) {
            return "";
        }/*  ww w.  j av a2  s.  com*/
        Iterator<String> iter = s.iterator();
        StringBuilder builder = new StringBuilder(iter.next());
        while (iter.hasNext()) {
            builder.append(delimiter).append(iter.next());
        }
        return builder.toString();
    }
}

Related

  1. join(List list, String separator, boolean ignoreNull)
  2. join(List list, String separator)
  3. join(List strList, String separator)
  4. join(List list, String separator)
  5. join(List list, String glue)
  6. implode(List strings, String glue)
  7. join(List texts, String separator)
  8. join(String separator, List data)
  9. concatenate(List elements, String delimiter)