Stream
- 28 August
A In-Depth guide to Java 8 Stream API
In this post, we will see an in-depth overview of Java 8 streams with a lot of examples and exercises. Introduction You may think that Stream must be similar to InputStream or OutputStream, but that’s not the case. A Stream represents a sequence of elements supporting sequential and parallel aggregate operations. Stream does not store […]
- 26 April
Java Stream sorted example
In this post, we will see how to sort a list with Stream.sorted() method. Java 8 has introduced Stream.sort() method to sort list of elements conveniently. It helps us to write short and concise functional style code rather than boilerplate code. java.util.Stream has two overloaded versions of sorted() method. sorted(): Returns a stream having elements […]
- 07 November
Java Parallel Stream
In this post, we will see about Parallel Stream in java. Java Parallel Stream introduction Java 8 introduces the concept of parallel stream to do parallel processing. As we have more number of cpu cores nowadays due to cheap hardware costs, parallel processing can be used to perform operation faster. Let’s understand with help of […]
- 17 October
Java 8 Stream of example
In this post, we will see about Java 8 Stream‘s of method example. stream‘s of method is static method and used to create stream of given type. For example: [crayon-674f3e3ea604d006923836/] There are two overloaded version of Stream’s of method. 1) static <T> Stream<T> of(T… values) Returns a sequential ordered stream whose elements are the specified values. […]
- 15 October
Java 8 Stream flatMap
In this post, we will see about Java 8 Stream flatMap function.Before understanding flatMap, you should go through stream’s map function Stream‘s flatMap method takes single element from input stream and produces any number of output values and flattens result to output stream.When you apply flatMap function on each of element of the stream, it results in […]
- 15 October
Java 8 Stream Map
In this post, we will see about Java 8 Stream map function. stream‘s map method takes single element from input stream and produces single element to output stream. Type of Single input Stream and Output stream can differ. Java 8 Stream Map function [crayon-674f3e3ea6263975585080/] Map function returns a stream consisting of the results of applying […]
- 13 September
Java 8 Stream filter examples
In this post, Â we are going to see about Java 8 Stream filter example. You can convert list or array to stream very easily and perform various operations on top of it.Java 8 Stream provides various methods such as map, Â filter, reduce etc. Let’s see more about Java 8 Stream filter method. Java 8 Stream […]
- 31 August
Java 8 Collectors examples
In this post, Â we are going to see java 8 Collectors examples. You can do various operations such as average, count, groupby, sort the list with the help of Collectors. I am not providing theory here, I think you will learn better with the help of examples. Examples: Counting: Counting is used to count number […]