Java List Join join(List tokens, String sep)

Here you can find the source of join(List tokens, String sep)

Description

join

License

Open Source License

Declaration

public static String join(List<String> tokens, String sep) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    public static String join(List<String> tokens, String sep) {
        StringBuilder result = new StringBuilder();
        if (!tokens.isEmpty()) {
            result.append(tokens.get(0));
        }/*from   www  . j av  a  2 s .  c o m*/
        for (String token : tokens.subList(1, tokens.size())) {
            result.append(sep);
            result.append(token);
        }
        return result.toString();
    }
}

Related

  1. join(List strings, String separator)
  2. join(List strings, String separator)
  3. join(List stringsToJoin, char delimiter)
  4. join(List strList, char separator)
  5. join(List strList, String sep)
  6. join(List tokens, String separator)
  7. join(List tokens, String separator)
  8. join(List values)
  9. join(List values, String delimiter)