Java List Join join(CharSequence delimiter, List elements)

Here you can find the source of join(CharSequence delimiter, List elements)

Description

join

License

Apache License

Declaration

public static String join(CharSequence delimiter, List<? extends CharSequence> elements) 

Method Source Code


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

import java.util.List;

public class Main {
    public static String join(CharSequence delimiter, List<? extends CharSequence> elements) {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < elements.size(); i++) {
            result.append(elements.get(i));
            if (i != elements.size() - 1) {
                result.append(delimiter);
            }/*from w  w w  .  ja va  2 s . co  m*/
        }
        return result.toString();
    }
}

Related

  1. concatAndJoin(String sep, List data, String prefix, String suffix)
  2. contains(List joinParams, int joinIndex)
  3. getJoinKeyValues(List tuple, List joinKeyIndices)
  4. join(char separator, List seqs)
  5. join(CharSequence delimiter, Iterable list)
  6. join(Collection list, String separator)
  7. join(Collection stringList, String seperator)
  8. join(Collection list, String delimiter)
  9. join(Collection list, String seperator)