Collections.sort()排序使用方法

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

  }); 

 

你可能感兴趣的:(Collections.sort()排序使用方法)