What are the main differences between Internal and External Iterator?

Main differences between Internal and External Iterator are as follows:

  • An Internal Iterator controls the iteration itself. In an External Iterator collection controls the iteration.
  • Internal Iterator can iterate elements in individually as well as in
  • Bulk (like forEach). External iterator iterates element one by one.
  • Internal Iterator does not have to iterate elements only sequentially. External Iterator always iterates sequentially.
  • Internal Iterator supports declarative programming style that goes well with functional programming. External Iterator follows imperative style OOPS programming.
  • Some people consider Internal Iterator code more readable than that of External Iterator.
Read the full book at www.amazon.com
Posted in Java 8, Java 8 Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*