![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
集合
txs小山
这个作者很懒,什么都没留下…
展开
-
jdbc 对象 集合 练习
查询emp表的数据将其封装为对象,然后装载集合,返回。 1、将数据从数据库查出 2、数据赋值给emp对象 3、将对象存入ArrayList集合中供使用mysql数据的准备1、建表:create table emp( id int, ename varchar(255), job_id int , mgr int, joindate date, salary double, bonus double, dept_id int ); 2、插入数据:insert into原创 2020-07-17 01:15:53 · 141 阅读 · 0 评论 -
JAVA 数据结构 集合map
map:public static void main(String[] args) { Map<String, String> m = new HashMap<>(); m.put("001","aa"); m.put("002","bb"); m.put("003","ccc"); //key相同时会将值覆盖 m.put("003","ccdc"); System.原创 2020-07-08 18:33:55 · 263 阅读 · 0 评论 -
JAVA 数据结构 Set
Set集合特点不包含重复元素的集合没有带索引的方法,所以不能使用普通for循环遍历实现类: HashSet由HashMap哈希表支持不保证迭代顺序可以null元素public static void main(String[] args) { Set<String> set = new HashSet<>(); set.add("hello"); set.add("world"); set.add("j原创 2020-07-07 23:34:24 · 73 阅读 · 0 评论 -
JAVA 集合 数组 遍历
JAVA的数组、集合,有多种遍历方式主要代码 ArrayList<Student> stu = new ArrayList<>(); stu.add(new Student("ww",31)); stu.add(new Student("ww",32)); stu.add(new Student("ww",33)); stu.add(new Student("ww",34)); Iterator&l原创 2020-07-07 20:03:48 · 150 阅读 · 0 评论 -
JAVA 增强for循环
概述原创 2020-07-07 19:41:38 · 104 阅读 · 0 评论 -
JAVA List
说的原创 2020-07-07 19:37:49 · 76 阅读 · 0 评论 -
JAVA 集合 删除元素
原文:https://www.iteye.com/blog/czj4451-1474047若需要删除,则需要修改指针位置错误代码//创建集合对象 Collection<Student> c = new ArrayList<>(); Student s1 = new Student("林青霞",2); Student s2 = new Student("看八字",22); Student s3 = new Stude原创 2020-07-07 18:44:57 · 109 阅读 · 0 评论 -
JAVA 集合
可重复public static void main(String[] args) { Collection<String> c = new ArrayList<>(); c.add("d1"); c.add("ad2"); c.add("dsfexcd"); c.add("d"); c.add("d"); c.add("2"); System.ou..原创 2020-07-07 16:34:11 · 67 阅读 · 0 评论 -
JAVA集合ArrayList
集合类特点:与数组容量不变不同,他是容量可以动态发生改变的一种数据结构ArrayList:E代表泛型,表示集合中存储的数据类型的一种限制。是一种可调整大小的数组实现构造方法与添加元素方法import java.util.ArrayList;public class StudentDemo { public static void main(String[] args) { //常用构造方法 ArrayList<String> arr = ne原创 2020-07-04 19:10:21 · 66 阅读 · 0 评论