What is the difference between a Collection and a Stream? - Cracking the Java Coding Interview

preview_player
Показать описание
Cracking the #Java #Coding #Interview - Question 50: What is the difference between a Collection and a Stream?
Рекомендации по теме
Комментарии
Автор

Streams can also produce an endlessly ongoing sequence of objects whereas collections always have a finite size.

jay_
Автор

A stream is just a middleman for you to ask for items from a source. That source can have any number of elements, including none. A collection already contains the objects. A stream can be used to ask for items that you can add to a collection, but the stream itself does not contain any items, only the collection.

ForgottenKnight
visit shbcf.ru