对ArrayList实例对象中的元素进行排序
2016-03-31 14:07
148 查看
代码如下:
运行结果:
import java.util.*; public class TestSort { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList a1 = new ArrayList(); a1.add(new Integer(1)); a1.add(new Integer(3)); a1.add(new Integer(2)); System.out.println(a1.toString()); Collections.sort(a1); System.out.println(a1.toString()); } }
运行结果:
相关文章推荐
- Lua协程(一)
- NoSQL 数据库系统对比
- 老叶观点:MySQL开发规范之我见
- codeforces 659F . Polycarp and Hay 搜索
- 将Flask部署到apache2
- zTree框架实用Demo
- 矩阵的存储及快速转置
- 用C++实现快速排序
- 《Linux内核分析》第六周学习总结
- zTree结合jquery.contextMenu.js实现右键菜单
- hdu 1010 Tempter of the Bone(dfs)
- Retrofit网络开源库
- forin遍历,解决Collection <__NSArrayM: 0x7ffa5261aa70> was mutated while being enumerated崩溃的问题
- 设计模式 单例模式 优雅的单例模式
- p354拓扑排序
- Collection、Set、List的区别
- 2016年的技术提升计划
- Json对象与Json字符串互转(4种转换方式)
- Android开发之WebView和JS交互详解
- VLC设置串流的TTL值