Terminal operations either return values of other types or do not return anything at all (produce just side effects). They do not allow other operations to be applied and close the stream.
In this post we will cover two terminal operations:
Object toArray(). Returns an array of values emitted by the stream.