Java List Join join(List values, String string)

Here you can find the source of join(List values, String string)

Description

join

License

Apache License

Declaration

public static String join(List<String> values, String string) 

Method Source Code

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

import java.util.List;

public class Main {
    public static String join(List<String> values, String string) {

        StringBuilder sb = new StringBuilder();
        int c = values.size();
        for (String val : values) {
            if (c-- > 1)
                sb.append(val + string);
            else//from   w w  w  . j  a  v a 2 s  .co m
                sb.append(val);

        }
        return sb.toString();
    }
}

Related

  1. join(List tokens, String sep)
  2. join(List tokens, String separator)
  3. join(List tokens, String separator)
  4. join(List values)
  5. join(List values, String delimiter)
  6. join(List words, String separator)
  7. join(List entries, String separator)
  8. join(List list, String delim)
  9. join(List list, String delim)