Files
Hui-s-notebook/logseq-java/journals/2022_04_20.md
2024-02-02 00:12:49 +08:00

102 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
- [[TreeSet]]
- [[HashMap]]
- [[TreeMap]]
- [[LinkedHashMap]]
- [[HashTable]]
- [[集合的交并差]]
- [[IO流]]
- [[字节流]]
-
-
-
- 总结
collapsed:: true
- TreeSet
- 红黑二叉树
- 所有节点要么红,要么黑
- 根节点一定为黑
- 红色节点的子节点,一定要为黑
- 从任何一种末梢子节点开始到根节点的过程中一定要有相同个数的黑色节点树
- {{embed ((625fe239-5548-4c66-ba66-f6fb1629b682))}}
- API方法与HashSet一致
- 排序借助ArrayList实现
- 去重
- 不依靠hashcode 以及equals
- 依靠比较器Comparable
- 元素一定要实现Comparable接口
- HashMap
- Map
- 基于Key-Vaalue的结构
- 特点
- Key不能重复
- Value可以重复
- 底层结构
- JDK1.7之前:数组 + 链表
- JDK1.7之后:数组 + 链表 + 红黑二叉树
- API方法
- put
- get
- replace
- delete
- deleteAll
- keySet
- values
- 去重
- 依靠hashcode和equals
- Key一定要重写 hashcode equals 方法
- 遍历
- forEach
- 获得Key的集合
- 通过Set集合获得每个元素
- TreeMap
- 特点
- Key去重,Value不去重
- Key有序存储
- 不能放null键,可以放null值
- API与HashMap一致
- 去重
- 借助比较器Comparable
- Key元素身上一定要实现Comparable
- LinkedHashMap
- HashMap为单向的,LinkedHashMap为双向的,底层原理一致
- API与HashMap一致
- HashTable
- 方法上有添加synchronized关键字
- 集合的交并差
- 交集
- retainAll
- 并集
- removeAll-->addAll
- 差集
- 利用第三个集合去除相加的部分后相加
- IO流
- Input
- 从程序外部将资源使用流的方式读取到程序内部
- Out
- 从程序内部将资源使用流的方式输出到程序外部
- 分类
- 走向
- 输入流
- 输出流
- 单位
- 字节流
- 字符流
- 功能
- 节点流
- 功能流
- 使用场景
- 上传下载文件
- 操作步骤
- 创建流
- 操作流
- 关闭流
- 字节流
- 流操作的最小单位
- 方向
- 输入字节流InputStream
- 输出字节流OutputStream
- File类
- mkdir
- exist
- isDirectory
- listFiles