Thursday, 21 July 2016

Java SE 8: Differences between External Iteration and Internal Iteration


In this post, we will discuss one of the important concept of Java SE 8 New features. That is Internal Iteration.

Oracle corporation has introduced "Internal Iteration" new feature as part of Java SE 8 release.

It has many advantages over External Iteration.

Differences between External Iteration and Internal Iteration:

1.Available before Java 8 too.It is introduced in Java SE 8
2.Iterating an Aggregated Object elements externally.Iterating an Aggregated Object elements internally (background).
3.Iterate elements by using for-each loop and Iterators like Enumeration, Iterator, ListIterator.Iterate elements by using Java API like “forEach” method.
4.Iterating elements in Sequential and In-Order only.Not required to iterate elements in Sequential order.
5.It follows OOP approach that is Imperative Style.It follows Functional Programming approach that is Declarative Style.
6.It does NOT separate responsibilities properly that is, it defines both “What is to be done” and “How it is to be done”.It defines only “What is to be done”. No need to worry about “How it is to be done”. Java API takes care about “How to do”.
7.Less Readable Code.More Readable code.
For more Java SE 8 tutorials, please go through my previous posts with "Java8" tag name.

Please drop me a comment if you like my post or have any issues.

Thank you for reading my tutorials.