Collections.sort()排序使用方法

来源:互联网 发布:php在线打包 编辑:程序博客网 时间:2024/04/28 02:12

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

  List reList = new ArrayList();
     
  Collections.sort(reList, new Comparator() {

   // Parameters:
   // o1 - the first object to be compared.
   // o2 - the second object to be compared.
   // Returns:
   // a negative integer, zero, or a positive integer as the first
   // argument is less than, equal to, or greater than the second.
   // Throws:
   // ClassCastException - if the arguments' types prevent them from
   // being compared by this Comparator.
   public int compare(Object o1, Object o2) {
    // TODO Auto-generated method stub
    return 0;
   }

  });

原创粉丝点击