fkjj.net
当前位置:首页 >> 如何实现ArrAyList的反转排序? >>

如何实现ArrAyList的反转排序?

用Collections.reverse(list)即可。如: List list = Arrays.asList(new String[] {"aa", "bb", "cc", "dd", "ee"}); Collections.reverse(list); for (String string : list) { System.out.println(string); }

方法一:实现Comparable接口排序package collsort.comparable; package com.cvicse.sort.comparable; public class Cat implements Comparable { private int age; private String name; public Cat(int age, String name) { this.age = age; th...

网站首页 | 网站地图
All rights reserved Powered by www.fkjj.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com