
业务相关
文章平均质量分 57
rookie_yanyu
这个作者很懒,什么都没留下…
展开
-
Stream流
allMatch() /** * allMatch()流中的元素必须全部符合筛选条件,才能返回true; * 否则,返回false。 */ public class AllMatchTest { public static void main(String[] args) { List<Integer> list = Arrays.asList(1,2,3,4,5); boolean res = list.stream().allMatch(e .原创 2021-07-05 22:31:25 · 76 阅读 · 0 评论 -
Google Guava
集合类 Immutable:不可变类型 public class Immutable { public static void main(String[] args) { System.out.println("immutableList:"); List<Integer> list = ImmutableList.of(1,2,3,4); // list.add(1); error list.stream().forEa.原创 2021-07-01 23:37:12 · 198 阅读 · 0 评论 -
缓存和数据库的一致性问题
缓存和数据库的双写一致性 参考:https://www.cnblogs.com/yanglang/p/9098661.html 前言 最近在实习,为了能在项目中写出简洁的代码,正在学习Google Guava这个工具包,看到了Cache这一块,就想起了这个面试常问的有关缓存和数据库的题,现在做一个温故知新,查阅了网络上相关文档,整理一下。 读取数据流程 读请求过来会首先请求缓存,如果缓存中存在数据,那么就将数据返回给客户端;否则,去请求数据库服务器,如果数据库中也没有数据,将空值返回给客户端;如果数据库中存原创 2021-06-29 00:02:54 · 112 阅读 · 0 评论