Stream Overview

1. Lambda Expressions

Basic use

2.Optional

Basic use

3.Stream

  • Creating Stream
  • Followed by zero or more intermediate operations  (methods below to map an example, most logical Similarly other methods)
  • Finally, add a termination operation
    • If the operation is not terminated, stream only constructed a series of objects, and objects inside the method call is not triggered, so the stream will not do anything
    • When there is no intermediate operation before the operation is terminated, for considerations of efficiency, the data source directly traverse
    • When there is an intermediate operating
      • By constructing the plant TerminalOp acquires corresponding  TerminalOp
      • evaluateSequential method call in TerminalOP
        • Call PipelineHelper of wrapAndCopyInto method (ReferencePipeline realized PipelineHelper Interface) for data to traverse

Guess you like

Origin www.cnblogs.com/flying-snake/p/11747203.html