Java SortedSet arrayToSortedStringSet(Collection strings)

Here you can find the source of arrayToSortedStringSet(Collection strings)

Description

array To Sorted String Set

License

Open Source License

Declaration

public static String arrayToSortedStringSet(Collection<String> strings) 

Method Source Code

//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();
    }
}

Related

  1. addMapEntry(Map> map, T1 keyEntry, T2 setEntry)
  2. asSortedSet(T... args)
  3. asSortedSet(T... elements)
  4. computeGraphCauselessFromGraphLmms( List>>> causesByDepByNameList)
  5. computeGraphCauselessFromGraphMms( SortedMap>> causesByDepByName)