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

我正在尝试在功能接口中格式化日期,但我不知道是否可能


SimpleDateFormat dt1 = new SimpleDateFormat("ddmmyyyyy");


List<MenuPrice> menuPrices = findAll(restaurant);


menuPrices.parallelStream()

          .collect(Collectors.groupingBy(dt1.format(MenuPrice::getUpdateDate)));


繁华开满天机
浏览 145回答 2
2回答

LEATH

这是可能的,但不能使用方法引用:Map<String,List<MenuPrice>> &nbsp;&nbsp;&nbsp;&nbsp;menuPrices.parallelStream() &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.collect(Collectors.groupingBy(m&nbsp;->&nbsp;dt1.format(m.getUpdateDate())));
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java