Most efficient way to get the last element of a stream
Posted 风来了
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Most efficient way to get the last element of a stream相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章
Secrets To Getting Amazon gift card codes To Complete Tasks Quickly And Efficiently
Paging through lots of data efficiently (and in an Ajax way) with ASP.NET 2.0
[Coding Made Simple] Coin Changes Number of ways to get a total
[poj 2886] Who Gets the Most Candies? 线段树
text 来自https://stackoverflow.com/questions/842059/is-there-a-portable-way-to-get-the-current-usernam