Streams vs Collections in Java
Streams vs Collections
Collections | Streams |
The collections are used to store & group data in data structures like List, Set, Map...etc. | Streams are used to perform complex operations like filtering, matching, mapping, etc... on stored data |
Data modification can be done. You can add or remove data from a Collection | Data cannot be modified |
External iterations need to be done | Internal iterations are being used |
Collections can be traversed | Streams can be traversed only once. If you need another traverse, you need to create a new stream |
Collections are eagerly constructed | Streams are lazily constructed |
0 comments :
Post a Comment