Java List Sort sortListStingArrayByFirstDes( List list)

Here you can find the source of sortListStingArrayByFirstDes( List list)

Description

sort List Sting Array By First Des

License

Apache License

Declaration

public static List<String[]> sortListStingArrayByFirstDes(
            List<String[]> list) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collections;
import java.util.Comparator;

import java.util.List;

public class Main {
    public static List<String[]> sortListStingArrayByFirstDes(
            List<String[]> list) {
        Comparator<String[]> com = new Comparator<String[]>() {
            public int compare(String[] o1, String[] o2) {
                double num1 = Double.valueOf(o1[0] == null ? "0" : o1[0]);
                double num2 = Double.valueOf(o2[0] == null ? "0" : o2[0]);
                if (num2 < num1) {
                    return 1;
                } else if (num2 > num1) {
                    return -1;
                } else {
                    return 0;
                }//from w ww  .ja  v  a2  s  .c  o  m
            }
        };
        Collections.sort(list, com);
        return list;
    }
}

Related

  1. sortList(List list, boolean asc)
  2. sortListAlphabetically(List list)
  3. sortListByMapKey(List> list)
  4. sortListEntry(List firstList, List secondList)
  5. sortListOfDoublesAndRemoveDuplicates(List items, double tolerance, double toleranceSmallNumbers)
  6. sortLocales(final List locales)
  7. sortLongSeqList(List firstList, List secondList)
  8. sortLoops(ArrayList list)
  9. sortMap(Map targetMap, List sortedList)