A fluent programming is the programming technique where operations return a value that allows the invocation of another operation. With the fluent programming, it is perfectly natural to end up with one huge statement that is the concatenation of as many operations as you like. The Java Development Kit (JDK) streams (added in Java 8) are designed to support fluent programming. Instead of looping over all elements in the sequence repeatedly (once for filter, then again for map, and eventually for toArray), the chain of filtermapper-collector can be applied to each element in just one pass over the sequence. In this context, we often encounter lambda expressions used to create locally defined anonymous functions. They provide a clear and concise way to represent one method interface using an expression. Oracle claims that use of lambda expressions also improve the collection libraries making it easier to iterate through, filter, and extract data from a collection. In addition, new concurrency features improve performance in multicore environments.
There are multiple ways to traverse, iterate, or loop collection in Java. Therefore, to solve one problem, we have several options for solutions that differ by undeniably increasing of the code readability. Searching for answers to the question of whether these new features really bring performance benefits over conventional way, is the subject of this paper.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.