List排序功能

    技术2024-11-01  26

    List排序

    按照时间元素排序

    按照时间元素排序

    private List<NumberBindInfo> list; Collections.sort(list, new Comparator<NumberBindInfo>() { @Override public int compare(NumberBindInfo o1, NumberBindInfo o2) { if (TextUtils.isEmpty(o1.getSubts()) || TextUtils.isEmpty(o2.getSubts())){ return 2; } if (o1.getSubts().compareTo(o2.getSubts()) > 0) { return -1; } else if (o1.getSubts().compareTo(o2.getSubts()) < 0) { return 1; } else { return 0; }
    Processed: 0.010, SQL: 9