lombok notes
@Getter and @Setter
https://projectlombok.org/features/GetterSetter
作用目标
- 类
- 字段
生成 gettter 名称
普通类型
- foo –> getFool()
boolean
- foo –> isFool()
Yaml ---- a kind of markup language
Tutorials
字符串
"", 双引号
进行转义
- eg: words: "Lucy \n Lily" 会换行
'', 单引号
转移字符无效,只是普通字符
- eg: words: "Lucy \n Lily" 不会换行
Gradle Notes
教程
运行
- 配置
| |
- gradlew run
打包
配置
1 2 3 4jar { baseName = 'gs-gradle' version = '0.1.0' }- gradlw build
依赖
| |
版本
| |
命令
gradlew tasks
Java IO
教程
java.io 包教程, 英文 https://www.tutorialspoint.com/java/io/index.htm
输入输出, 中文视频教程 https://www.w3cschool.cn/minicourse/play/java_io_my#menulist
文件与路径
File 类
- 用于文件本身属性和操作(增删改查)
Java 7 新包
java.nio.file https://blog.csdn.net/qq877728715/article/details/104499687/
Files 类
- 文件复制,linux 属性 rwx 等高级功能
Path 类
- 新工具,用来取代 java.io.file.File 类
相对路径
Java Collections Notes
map
使用
- 使用 Map<KeyType, ValueType> 声明引用变量
使用实现类(如:new HashMap<>()),创建被引用对象
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15@RestController public class ProductServiceController { private static Map<String, Product> productRepo = new HashMap<>(); static { Product honey = new Product(); honey.setId("1"); honey.setName("Honey"); productRepo.put(honey.getId(), honey); Product almond = new Product(); almond.setId("2"); almond.setName("Almond"); productRepo.put(almond.getId(), almond); } }
实现类
- HashMap