• Java 8 Method reference
    22 April

    Java 8 Method reference

    Java 8 has introduced a lot of new features such as lambda expressions, stream, Method references etc. In this post, we will see what are Method references and how can we use it. I will try to provide more examples rather than theory. Introduction to Method Reference Method references are special types of lambda expressions […]

  • Convert LocalDateTime to Date in Java
    15 May

    Java LocalDateTime to Date

    In this post, we will see how to convert LocalDateTime to Date. Java 8 has introduced a lot of new APIs for Date and time. There can be many ways to convert Java LocalDateTime to date. Using Instant object You can convert LocalDateTime to date using Instant object which we can from ZonedDateTime. Here is […]

  • Java 8 Tutorial
    20 May

    Java 8 tutorial

    In this post, we will see about Java 8 tutorial. I have written a lot of tutorials on Java 8. This is index post for all Java 8 posts. Java 8 has lots of new features which will change the way you do programming. Here is a list of features you need to know to […]

  • Java 8 Optional
    19 May

    Java 8 Optional

    In this post, we will see about Java 8 optional. Did you ever get NullPointerException as Java developer? If you are experienced Java developer, you might have got NullPointerException at some point of time. You might agree that NullPointerException is pain for novice or expert core Java developer. You have to put a lot of […]

  • Java 8 Stream.of example
    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-61a2b89878847305405975/] 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. […]

  • Java 8 Function
    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. […]

  • Java Stream collect to array
    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 […]

  • Difference between map and flatmap in java
    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 […]

  • Java 8 Parallel Stream
    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 […]