Java List Join joinNiceString(List strings)

Here you can find the source of joinNiceString(List strings)

Description

join Nice String

License

Apache License

Declaration

public static String joinNiceString(List<String> strings) 

Method Source Code

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

import java.util.List;

public class Main {
    public static String joinNiceString(List<String> strings) {
        StringBuilder stringbuilder = new StringBuilder();
        int i = 0;
        for (String s : strings) {
            if (i > 0) {
                if (i == strings.size() - 1) {
                    stringbuilder.append(" and ");
                } else {
                    stringbuilder.append(", ");
                }/*from  www  .  ja  va 2  s.com*/
            }

            stringbuilder.append(s);
            i++;
        }

        return stringbuilder.toString();
    }
}

Related

  1. joinLists( final List> lists)
  2. joinLists(List A, List B, double epsilon)
  3. joinLists(List... list)
  4. joinListToString(List lsStr, String sSeparator)
  5. joinLong(List lst, String prefix)
  6. joinRecords(List first, List second, String key)
  7. joinRelativePath(List components)
  8. joinSegments(List segments, int startIndex, int endIndex)
  9. joinString(java.util.List values, String delimiter)