为了账号安全,请及时绑定邮箱和手机立即绑定

在 Function<T,R> 中格式化日期

在 Function<T,R> 中格式化日期

繁华开满天机 2021-09-29 16:22:46
我正在尝试在功能接口中格式化日期,但我不知道是否可能SimpleDateFormat dt1 = new SimpleDateFormat("ddmmyyyyy");List<MenuPrice> menuPrices = findAll(restaurant);menuPrices.parallelStream()          .collect(Collectors.groupingBy(dt1.format(MenuPrice::getUpdateDate)));
查看完整描述

2 回答

?
LEATH

TA贡献1936条经验 获得超6个赞

这是可能的,但不能使用方法引用:

Map<String,List<MenuPrice>>
    menuPrices.parallelStream()
              .collect(Collectors.groupingBy(m -> dt1.format(m.getUpdateDate())));


查看完整回答
反对 回复 2021-09-29
  • 2 回答
  • 0 关注
  • 144 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信