Advertisement

Use in Traversing Objects

  • Ralph Lecessi
Chapter

Abstract

The traversal of data structures has been simplified through the use of consumers which can be used to replace the while loops associated with iterators. In Java 8, the default forEachRemaining method which accepts a consumer was added to the Iterator interface. The PrimitiveIterator interface can be used to traverse a Java array of certain primitive types. In Java 8, the default forEach method, which accepts a consumer, was added to the Iterable interface.

Copyright information

© Ralph Lecessi 2019

Authors and Affiliations

  • Ralph Lecessi
    • 1
  1. 1.Kendall ParkUSA

Personalised recommendations