1 package cn.itcast.p4.list.demo;
2
3 import java.util.List;
4 import java.util.ArrayList;
5
6 public class ListDemo {
7
8 public static void main(String[] args) {
9 // TODO Auto-generated method stub
10 List list = new ArrayList();
11 show(list);
12
13 }
14
15 private static void show(List list) {
16 //添加元素
17 list.add("abc1");
18 list.add("abc2");
19 list.add("abc3");
20 System.out.println(list);
21 //插入元素。
22
23 // list.add(1,"abc9");
24
25 //删除元素。
26 // System.out.println("remove:"+list.remove(2));
27
28 //修改元素。
29 // System.out.println("ser:"+list.set(1, "abc8"));
30
31 //获取元素。
32 System.out.println("get:"+list.get(0));
33
34 //获取子列表。
35 System.out.println("sublist:"+list.subList(1, 2));
36 System.out.println(list);
37 }
38
39 }

最新文章

  1. AEAI ESB路由转换机制说明
  2. Cocos2dx集成于windows桌面窗口程序的步骤
  3. IntelliJ IDEA 14 SVN无法正常使用问题
  4. CodeForce---Educational Codeforces Round 3 The best Gift 解题报告
  5. Django1.7.1设置TEMPLATE_DIRS
  6. 提交svn报错说 有 unversioned 的文件
  7. python cmd模块练习
  8. OpenCV配置使用版
  9. html不常见问题汇总
  10. [Swift]LeetCode318. 最大单词长度乘积 | Maximum Product of Word Lengths
  11. Spring注解与Java元注解小结
  12. hdu5017 Ellipsoid (模拟退火)
  13. A1066. Root of AVL Tree
  14. 【洛谷P2860】冗余路径
  15. Linux之为集群内的机器设定主机名
  16. asp.net webapi 自定义身份验证
  17. rtmp简要流程
  18. 批量增删改"_bulk"
  19. Ubuntu安装UFW防火墙
  20. ffmpeg 合并aac格式音频文件

热门文章

  1. SpringBoot整合nacos启动报错:java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
  2. linux(centos)系统安装activemq
  3. c++设计模式概述之命令
  4. 【LeetCode】622. Design Circular Queue 解题报告(Python & C++)
  5. Java编程基础
  6. Android物联网应用程序开发(智慧园区)—— 登录界面开发
  7. 通过Rancher Desktop在桌面上运行K8s
  8. What's new in Dubbo-go v1.5.1
  9. 【】JSON介绍
  10. SpringBoot 之 实现登录功能及登录拦截器