Collections.sort new Compartor<> 用法

    public List<OrderItemAttributeDispInfoBean> sortOrderItemAttributes(List<OrderItemAttributeDispInfoBean> orderItemAttributes){
      
      Collections.sort( orderItemAttributes, new Comparator<OrderItemAttributeDispInfoBean>(){
        public int compare(OrderItemAttributeDispInfoBean o1,OrderItemAttributeDispInfoBean o2){
          return ( o1.getDisplaySequence() - o2.getDisplaySequence()) > 0 ? 1: -1;
        }
      } );
      
      return orderItemAttributes;
    }


你可能感兴趣的:(Collections.sort new Compartor<> 用法)