Java 8
- 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 […]
- 24 October
Java 8 – java.util.function.Function example
In this post, we will see about java.util.function.Function functional interface. java.util.function.Function is part of java.util.function package. There are some inbuilt functional interfaces in java.util.function which you can use if functional interface matches with your requirement. java.util.function.Function is a functional interface which takes input single argument T and returns result R. It has an abstract method as below. […]
- 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-6767cf511eb4b514016797/] 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. […]
- 17 October
Java Stream collect to array
In this post, we will see how to collect any Java 8 Stream to array. There are many ways to do it but I am going to show easiest way. You can simply use toArray(IntFunction<A[]> generator).This generator function takes size as input and creates new array of that size. Convert Steam to Array Let’s understand […]
- 16 October
Difference between map and flatMap in java
In this post, we will see the difference between map and flatMap in java.I have already covered Stream’s map and flatMap methods in previous articles. As you might know, Stream’s map and flatMap method both can be applied on Stream<T> and return Stream<R> as output. The actual difference is, map operation produces one output value […]
- 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-6767cf511eed7359899266/] Map function returns a stream consisting of the results of applying […]
- 10 September
Top 30 Java 8 interview questions and answers
In this post, we will some important interview questions specifically on Java 8. Java has changed a lot over years and Java 8 has introduced many new features which you need to know when you are preparing for Java interview.  Here is a list of most asked Java 8 interview questions. 1)  What are […]
- 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 […]