
Java的 arraylist类【具体案例】
发布日期:2021-05-14 16:18:36
浏览次数:8
分类:精选文章
本文共 2331 字,大约阅读时间需要 7 分钟。
List���������
-
ArrayList [������]
-
���������������������������������������������������������������������������������������
-
JDK1.2���������������������������������������������������������������������������������
-
���������������������������������������������������������������������������������������������������������������������������������
-
-
List���������������
-
���������������������������������������������������������������������������������������������������������������������������������������������������
public class TestArraylist { public static void main(String[] args) { // ������ ArrayList ������ ArrayList ary = new ArrayList(); // ������������ Student s = new Student("������", 12); Student s1 = new Student("������", 11); Student s2 = new Student("������", 14); ary.add(s); ary.add(s1); ary.add(s2); // ������������������������ System.out.println("������������������������" + ary.size()); System.out.println("ArrayList ���������" + ary.toString()); // ������������������ System.out.println("\n���������������"); System.out.println("���������������������" + ary.contains(new Student("������", 12))); if (ary.remove(new Student("������", 12))) { System.out.println("������������������������"); } else { System.out.println("������������������������������������"); } // ��������������� System.out.println("\n������������������������������"); ListIterator lis = ary.listIterator(); System.out.println("���������������"); while (lis.hasNext()) { Student student = (Student) lis.next(); System.out.println("���������������������������������" + student); } System.out.println("���������������"); while (lis.hasPrevious()) { Student student = (Student) lis.previous(); System.out.println("������������������������������" + student); } // ������������������ System.out.println("\n���������������������" + ary.contains(new Student("������", 12))); System.out.println("���������������" + ary.isEmpty()); System.out.println("���������������������" + ary.indexOf(new Student("������", 12))); }
发表评论
最新留言
哈哈,博客排版真的漂亮呢~
[***.90.31.176]2025年04月09日 16时16分07秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
CSS入门总结
2021-05-09
使用 TortoiseGit 时,报 Access denied 错误
2021-05-09
基于 HTML5 WebGL 的污水处理厂泵站自控系统
2021-05-09
[系列] Go gRPC 调试工具
2021-05-09
django-表单之模型表单渲染(六)
2021-05-09
c++之程序流程控制
2021-05-09
AlwaysOn配置时在连接步骤时报错(35250)
2021-05-09
spring-boot-2.0.3之redis缓存实现,不是你想的那样哦!
2021-05-09
httprunner学习23-加解密
2021-05-09
有道云笔记 同步到我的博客园
2021-05-09
李笑来必读书籍整理
2021-05-09
http头部 Expect
2021-05-09
Hadoop(十六)之使用Combiner优化MapReduce
2021-05-09
《机器学习Python实现_10_06_集成学习_boosting_gbdt分类实现》
2021-05-09
CoreCLR源码探索(八) JIT的工作原理(详解篇)
2021-05-09
IOS开发Swift笔记16-错误处理
2021-05-10
flume使用中的一些常见错误解决办法 (地址已经使用)
2021-05-10
andriod 开发错误记录
2021-05-10
C语言编译错误列表
2021-05-10