Java List Join listToText(List list, String join)

Here you can find the source of listToText(List list, String join)

Description

list To Text

License

Open Source License

Declaration

public static String listToText(List<String> list, String join) 

Method Source Code

//package com.java2s;
/*/*from  w ww . ja va  2  s .c o  m*/
 * Copyright (c) 2013, 2014 Chris Newland.
 * Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD
 * Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki
 */

import java.util.List;

public class Main {
    public static String listToText(List<String> list, String join) {
        StringBuilder builder = new StringBuilder();

        for (String line : list) {
            builder.append(line).append(join);
        }

        if (builder.length() > 0) {
            builder.deleteCharAt(builder.length() - 1);
        }

        return builder.toString();
    }
}

Related

  1. joinToString(List list)
  2. JoinToString(List list, String delimiter)
  3. joinUnique(List list, T element)
  4. joinWordList(List wordList, String delimiter)
  5. listToStr(List list, String joinChar)
  6. orderJoinType(List jList)
  7. reverseJoinType(List jList)
  8. sortAndJoin(List col, String sep)
  9. sortAndJoin(List list)