Java String Join join(T delimiter, List list)

Here you can find the source of join(T delimiter, List list)

Description

join

License

LGPL

Declaration

public final static <T> String join(T delimiter, List<T> list) 

Method Source Code


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

import java.util.*;

public class Main {
    public final static <T> String join(T delimiter, List<T> list) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            sb.append(list.get(i));//w  w  w . j  ava 2 s. c  o  m
            if (i <= list.size() - 1)
                sb.append(delimiter);
        }
        return sb.toString();
    }
}

Related

  1. join(String separator, String... strings)
  2. join(String splitter, String... strs)
  3. join(String str[], String splitter)
  4. join(String... paths)
  5. join(String... xs)
  6. join2(String connector, String... strs)
  7. joinColumns(Iterable columns)
  8. joinedList(T first, T... others)
  9. joinIterable(Iterable element, String separator)