What is the difference between collection and stream?
S.no | Collection API | Stream API |
---|---|---|
1. | Collection API is for storing the data in the different kinds of data structures. | Stream API is not a data structure; it is used for computation of the data on the big set of objects |
2. | A finite number of elements can be stored in a data structure | An infinite number of features can be stored |
3. | Consumption of elements is multiple times | Consumption of elements is only once. |
BY Best Interview Question ON 02 Feb 2020