首页 > 其他 > 详细

Most efficient way to get the last element of a stream

时间:2017-05-12 12:32:53      阅读:393      评论:0      收藏:0      [点我收藏+]
Do a reduction that simply returns the current value:

Stream<T> stream; T last = stream.reduce((a, b) -> b).orElse(null);

Most efficient way to get the last element of a stream

原文:http://www.cnblogs.com/yuyutianxia/p/6844773.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!