Skip to main content

Posts

Showing posts from July, 2021

What are the main uses of the Stream API in Java 8?

  Stream is a feature in Java 8. Stream supporting Internal iteration which will provides several features such as sequential and parallel execution, filtering based on the given criteria, mapping etc. Java 8 Stream support sequential as well as parallel processing, parallel processing can be very helpful in achieving high performance for large collections. All the Java Stream API interfaces and classes are in the  java.util.stream  package. Since we can use primitive data types such as int, long in the collections using auto-boxing and these operations could take a lot of time, there are specific classes for primitive types –  IntStream ,  LongStream  and  DoubleStream. For Example , you might want to create a collection of employees to represent a company's staff information. Then, you might want to process the whole collection to find out how many days that employee works for the company. First , we may iterate over the collections to process some works such as “ finding ” (find