Java List Concatenate concatLineSeparated(List discountCommentCauseList)

Here you can find the source of concatLineSeparated(List discountCommentCauseList)

Description

Concat a List of Strings separated by a \n\n

License

Open Source License

Parameter

Parameter Description
discountCommentCauseList a list of Strings

Return

a String concatenated and separated by \n\n

Declaration

public static String concatLineSeparated(List<String> discountCommentCauseList) 

Method Source Code

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

import java.util.*;

public class Main {
    /**// w w w .  j a  va 2  s.  co  m
     * Concat a List of Strings separated by a \n\n
     *
     * @param discountCommentCauseList a list of Strings
     * @return a String concatenated and separated by \n\n
     */
    public static String concatLineSeparated(List<String> discountCommentCauseList) {
        String result = "";
        for (String discountCommentCause : discountCommentCauseList) {
            result += discountCommentCause + "\n\n";
        }
        if (discountCommentCauseList.size() > 0) {
            result = result.substring(0, result.lastIndexOf("\n\n"));
        }
        return result;
    }
}

Related

  1. concatGenericList(List list, String delimiter)
  2. concatinateStrings(List strList, String delim)
  3. concatIntegersToRanges( List damages)
  4. concatLines(List lines)
  5. concatLines(List lines)
  6. concatList(List list)
  7. concatList(List... array)
  8. concatList(List strings)
  9. concatListToString(List suggestedList)