八月技术杂记(待整理)

第一周

Date:7.29~8.04

  • 异步任务的流程:使用消息队列,分别为记录到数据库、发送到消息队列、topic和tag加上框架连接、处理对应的业务逻辑
  • postman 可以设置局部变量
  • In the asynchronous callback test (there is one consumer online and one consumer local), since both consumers can handle messages, when an exception occurs, the two consumers will explode the heavy message exponentially. I choose to comment out my tag.
  • list.stream().findFirst().orElse(null);
  • List places = Arrays.asList(“Buenos Aires”, “Córdoba”, “La Plata”);
  • List.sort(Comparator.comparingInt(Object::getPriority))
  • map.forEach((k,v)->{System.out.println(k + " = " + v);});
    创建普通内部类的代码如下:

Outer o = new Outer();

Outer.Inner inner = o.new Inner();

Outer.Inner inner = new o.Inner(); /* 错误 */

Outer.Inner inner = new Outer.Inner(); /* 错误 */

静态内部类没有外部对象的引用,所以它无法获得外部对象的资源,当然好处是,静态内部类无需依赖于

外部类,它可以独立于外部对象而存在。创建静态内部类的代码如下:

Outer.Inner inner = new Outer.Inner();

List cities = Arrays.asList(“Milan”,
“London”,
“New York”,
“San Francisco”);
String citiesCommaSeparated = String.join(",", cities);
System.out.println(citiesCommaSeparated);
//Output: Milan,London,New York,San Francisco

String citiesCommaSeparated = cities.stream()
.collect(Collectors.joining(","));
System.out.println(citiesCommaSeparated);
//Output: Milan,London,New York,San Francisco
Note: you can statically import java.util.stream.Collectors.joining if you prefer just typing “joining”.

Map<Integer, Integer> map = new HashMap<Integer, Integer>();

for (Map.Entry<Integer, Integer> entry : map.entrySet()) {

System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());

}

Use MVC to receive JSON lists or sets: @RequestParam(“appId”) int appId,@RequestParam(value = “isTmp”, required = false) boolean isTmp,@RequestBody Set fileKeys;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值