1.

What is the most common type of Terminal operations?

Answer»
  • collect() - Collects single result from all elements of the stream sequence.
  • reduce() - PRODUCES a single result from all elements of the stream sequence
    • count() - Returns the number of elements on the stream.
    • min() - Returns the min ELEMENT from the stream.
    • max() - Returns the max element from the stream.
  • Search/Query operations
    • anyMatch() , noneMatch() , allMatch() , ... - Short-circuiting operations.
    • Takes a Predicate as input for the match condition.
    • Stream processing will be STOPPED, as and when the result can be determined.
  • Iterative operations
    • forEach() - Useful to do something with each of the Stream elements. It accepts a consumer.
    • forEachOrdered() - It is helpful to maintain order in PARALLEL streams.


Discussion

No Comment Found