更新时间:2022-04-03 09:41:21
不.由于它应该是一个三行函数,因此您***坚持使用您编写的代码.
Nope. Since it should be about a three-line function, you're probably better of just sticking with the one you coded.
Java 8 的语法非常简单,我什至不确定是否值得为以下对象创建函数:
With Java 8, the syntax is simple enough I'm not even sure if it's worth creating a function for:
List<String> eatFoods = foodNames.stream()
.map(s -> "eat an " + s)
.collect(Collectors.toList());