Java Utililty Methods ArrayList Sort

List of utility methods to do ArrayList Sort

Description

The list of methods to do ArrayList Sort are organized into topic(s).

Method

voidsortArray(ArrayList list)
sort Array
String tmp;
if (list.size() <= 1)
    return;
for (int i = 0; i < list.size(); i++) {
    String s1 = (String) list.get(i);
    for (int j = i + 1; j < list.size(); j++) {
        String s2 = (String) list.get(j);
        if (s1.compareToIgnoreCase(s2) > 0) {
...
voidsortByNibble(ArrayList symbolAL, int delimiter)
sort By Nibble
ArrayList<Character> bucketOneAL = new ArrayList<Character>();
ArrayList<Character> bucketTwoAL = new ArrayList<Character>();
for (int i = 0; i < symbolAL.size(); i++) {
    int tempI = Integer.parseInt(symbolAL.get(i).toString(), 16);
    if (tempI > delimiter) {
        bucketTwoAL.add(symbolAL.get(i));
    } else {
        bucketOneAL.add(symbolAL.get(i));
...
StringsortedPatterns(ArrayList patterns)
sorted Patterns
Map<String, Integer> wordCount = new HashMap<String, Integer>();
Set<String> unique = new HashSet<String>(patterns);
for (String key : unique) {
    wordCount.put(key, Collections.frequency(patterns, key));
List<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>(wordCount.entrySet());
Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
    public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
...
ArrayListsortImports(ArrayList imports)
sort Imports
ArrayList<String> javaImports = new ArrayList<String>();
ArrayList<String> javaxImports = new ArrayList<String>();
ArrayList<String> orgImports = new ArrayList<String>();
ArrayList<String> comImports = new ArrayList<String>();
ArrayList<String> miscImports = new ArrayList<String>();
for (String s : imports) {
    if (s.startsWith("java")) {
        javaImports.add(s);
...
voidsortSignatures(ArrayList sList)
Sort first by method name, then by parm list number and value
Collections.sort(sList, new Comparator<String>() {
    @Override
    public int compare(String sig1, String sig2) {
        String name1 = sig1.substring(sig1.indexOf(SPACE) + 1, sig1.indexOf(LEFT_PAREN));
        String name2 = sig2.substring(sig2.indexOf(SPACE) + 1, sig2.indexOf(LEFT_PAREN));
        String parms1 = sig1.substring(sig1.indexOf(LEFT_PAREN), sig1.indexOf(RIGHT_PAREN) + 1);
        String parms2 = sig2.substring(sig2.indexOf(LEFT_PAREN), sig2.indexOf(RIGHT_PAREN) + 1);
        int retval = name1.compareTo(name2); 
...
ArrayListSortStringList(ArrayList list)
Convenience methods that makes it easier to sort a String list
return (ArrayList<String>) Sort(list);