Here you can find the source of sortAndFormat(List
public static String sortAndFormat(List<String> stringList)
//package com.java2s; //License from project: Creative Commons License import java.util.Arrays; import java.util.List; public class Main { public static String sortAndFormat(List<String> stringList) { if (stringList == null) { return ""; }// w w w . ja va2s.c om String[] stringArray = stringList.toArray(new String[0]); Arrays.sort(stringArray); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < stringArray.length; i++) { if (i > 0) { buffer.append(";"); } buffer.append(stringArray[i]); } return buffer.toString(); } }