Here you can find the source of SortStringList(ArrayList
Parameter | Description |
---|---|
list | List to sort |
@SuppressWarnings("unchecked") public static ArrayList<String> SortStringList(ArrayList<String> list)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.*; public class Main { /** Convenience methods that makes it easier to sort a String list */*from w ww . j av a 2 s . c o m*/ * @param list List to sort * @return Sorted list */ @SuppressWarnings("unchecked") public static ArrayList<String> SortStringList(ArrayList<String> list) { // ArrayList<NumericString> numericStringList = new ArrayList<NumericString>(); // for (String item : list) // numericStringList.add(new NumericString(item)); // // Collections.sort(numericStringList); // // ArrayList<String> sortedList = new ArrayList<String>(); // for (NumericString item : numericStringList) // sortedList.add(item.toString()); // // return sortedList; return (ArrayList<String>) Sort(list); } /** Convenience methods that makes it easier to sort a collection * * @param list Collection to sort * @return Sorted list */ public static ArrayList Sort(Collection list) { ArrayList newList = new ArrayList(list); Collections.sort(newList); return newList; } }