Abhishek Kumar
Abhishek Kumar

Reputation: 1

Is there any difference between Stream API and I/O Streams ? Someone give a brief explanation please

I have a little idea about stream api. I was told that it is used to extract data from the collection classes. It only used for readable purpose.But i have no idea about I/O streams. Its so confusing because of the same naming style. Please elaborate me

I just tried the explanation from difference websites but did not got clarified. I am expecting a full fledged explanation from someone. Thank you....

Upvotes: 0

Views: 80

Answers (1)

Gautam Govind
Gautam Govind

Reputation: 11

See Iostream is simply flow of data (input and output) from particular source like Console, Files, String or Network and same can be for destination. It includes Reading data from (and writing data to) Keyboard or files or string. For example, you will find iostream, ifstream, fstream , stringstream in C++ and System.out, System.in or java.util.Scanner in Java is used for Input and Output Operations.

Whereas Stream API is powerful tool for processing set of elements. It takes input from the Collections, Arrays or I/O channels. Streams don’t change the original data structure, they only provide the result as per the pipelined methods. It has set of methods like map(), filter() etc for sorting arrays or lists as to process collection of objects.

Upvotes: 1

Related Questions