Most efficient way to get the last element of a stream
2017-05-12 11:35
417 查看
Do a reduction that simply returns the current value: Stream<T> stream; T last = stream.reduce((a, b) -> b).orElse(null);
相关文章推荐
- To find the kth to Last Element of a Singly Linked List
- Seven effective ways to get the most out of the morning
- More than one way to get the max of 3 numbers.
- get paid from、 to the taste of、expand my horizons、available、by the way
- Hacking Vim: A Cookbook to get the Most out of the Latest Vim Editor
- Are you looking for a way to get the entire text of a word document into a RichEdit without using the Clipboard?
- Photoshop CS2 RAW : Using Adobe Camera Raw, Bridge, and Photoshop to Get the Most out of Your Digita
- How to get the value of a form element : check box and radio button
- [CrackCode] 2.2 Find the nth to last element of a singly linked list
- Find the nth to last element of a singly linked list
- Visual C the best way to get the contents of a file directory into a list
- Best way to get the index of an iterator
- Q2.2 Find the kth to last element of a singly linked list
- Tweaking your system to get the most out of BitTorrent
- The best way to get unique elements of a list in Python
- [读书笔记]How to Get the Most of Studying
- 步步为营VS 2008 + .NET 3.5(7) - LINQ查询操作符之First、FirstOrDefault、Last、LastOrDefault、ElementAt、ElementAtOrDefault、Contains、Any、All、Count、LongCount、Sum、Min、Max、Average、Aggregate、Cast、DefaultIfEmpty、SequenceEqual、OfType、ToArray、ToList、ToDictionary
- How to get the size of file in C++ - 在C++中如何获取文件的大小
- Get to the Top on Google: Tips and Techniques to Get Your Site to the Top of the Search Engine Ranki
- On the Way to the Web: The Secret History of the Internet and Its Founders