On Java 8 Collection Processing, a Today Software Magazine Article
10 September 2014 | Community & Events
Ovidiu Simionica made an objective overview of Java 8 in the article he published in the 24th issue of Today Software Magazine (TSM).
The article starts by exposing a few disappointments Java fans had to face over the years such as the 7 year delay vs C# in offering functional programming or failure through type erasure for generics. Ovidiu shares his thoughts on data collection processing, also known as filtering, an issue of particular interest for him over the years. A complicated code sample of what developers and architects had to write prior to Java 8 to do filtering is provided. Java 8 collection processing allows developers to do parallel processing and optimal use of processor cores, which are mandatory for scalable and effective application in the “Big Data” era. Or at least that is what it pretends to do.
Ovidiu examines next the “parallel()” method, which is supposed to divide the library stream into tiny pieces so that they can be processed in parallel. The pitfalls of the Paraquential phenomenon and the explicit use of a ForkJoinPool, the solution to this problem proposed by Oracle, are then addressed. The Paraquential phenomenon is “[a portmanteau word derived by combining parallel with sequential] the illusion of parallelization. Processing starts out in parallel mode by engaging multiple threads but quickly reverts to sequential computing by restricting further thread commitment.” (Edward Hardned, 2014).
The conclusion of the article is that parallel pools of data can be managed but the process is complex and risky. According to Ovidiu, Java gives us half-measures again and the parallel method is one to be kept in the “dangerous code” list in the programming and code review activities.
Topics: Java, Today Software Magazine