Keep reading…
In some programming languages, there are two types of operations on data constructs. One is terminal operation and the other is intermediate operation.
A terminal operation terminates immediately after it is applied because it gives a result of different type than the original type of the construct. Like this.
- result = construct.someOperation()
While in case of intermediate operations, you can chain various operations on intermediate results because the results are of same type as the original type of the construct. Like this.
- result = construct.someOperation().someOtherOperation().someOtherOperation()…
Now you have the option of choosing which kind of operation you want to apply to your life. The terminal one or the intermediate one.
Think like this.
Terminal operation will leave you with a different result than what you expect.