charkey

“15,5,9,17,99,107,47”转List<Long>

List<Long> linkCompanyIds = Arrays.asList("15,5,9,17,99,107,47".split(",")).stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());

  

15, 16, 1, 89, 9, 89, 9, 16, 15 去重,排序 后 转 List<Integer>

List<Integer> list = Arrays.asList(15, 16, 1, 89, 9, 89, 9, 16, 15);
list.stream().distinct().sorted((Integer s1, Integer s2) -> s1 - s2).forEach(System.out::println);

  

对 List<Map<String,Object>> 中的 日期排序 及 字段过滤(针对KUDU返回数据)

data.stream().filter((p) -> MapUtils.getDouble(p, "saraly") > 15000)
.sorted((Map<String, Object> d1, Map<String, Object> d2) -> MapUtils.getLong(d2, "createTime")
.compareTo(MapUtils.getLong(d1, "createTime")))
.forEach(i -> System.out.println(new Gson().toJson(i)));

  

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2018-06-27
  • 2021-10-22
  • 2021-08-06
猜你喜欢
  • 2021-04-12
  • 2021-12-29
  • 2021-08-31
  • 2021-09-24
相关资源
相似解决方案