Java ArrayList Sort SortStringList(ArrayList list)

Here you can find the source of SortStringList(ArrayList list)

Description

Convenience methods that makes it easier to sort a String list

License

Open Source License

Parameter

Parameter Description
list List to sort

Return

Sorted list

Declaration

@SuppressWarnings("unchecked")
public static ArrayList<String> SortStringList(ArrayList<String> list) 

Method Source Code


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

Related

  1. sortArray(ArrayList list)
  2. sortByNibble(ArrayList symbolAL, int delimiter)
  3. sortedPatterns(ArrayList patterns)
  4. sortImports(ArrayList imports)
  5. sortSignatures(ArrayList sList)