Here you can find the source of arrayToSortedStringSet(Collection
public static String arrayToSortedStringSet(Collection<String> strings)
//package com.java2s; /**/*from w w w. java 2 s. c o m*/ * Copyright 2009, Google Inc. All rights reserved. * Licensed to PSF under a Contributor Agreement. */ import java.util.Collection; import java.util.Set; import java.util.TreeSet; public class Main { public static String arrayToSortedStringSet(Collection<String> strings) { Set<String> sorter = new TreeSet<String>(); sorter.addAll(strings); return arrayToString(sorter); } public static String arrayToString(Collection<String> strings) { StringBuffer sb = new StringBuffer(); for (String s : strings) { sb.append(s).append("\n"); } return sb.toString(); } }