• 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 […]

  • 08 May

    Java String join example

    String’s join method can be used to join various String by the delimiter. It is introduced in java 8. For example: We need to join various Strings by “,”. You can use join method as [crayon-60066321d3dbc738192387/] There are two overloaded variants of String’s join method: [crayon-60066321d3dc2945341369/] String join example: [crayon-60066321d3dc3244787413/] When you run above program, […]

  • 01 September

    Collectors.groupby example : How to do group by in java

    We have already seen some examples on Collectors in previous post.  In this post, we are going to see Java 8 Collectors groupby example. Groupby is another feature added in java 8 and it is very much similar to SQL/Oracle. Lets understand more with the help of example: Lets create our model class country as […]

  • 05 September

    Java 8 forEach examples

    In this post, we will see improved way of iterating through map and list which are introduced in java 8. Map: Normal way of iterating HashMap before java 8: [crayon-60066321d4246099692330/] Improved way of iterating HashMap in java 8: [crayon-60066321d424a947025674/] When you run above program, you will get below output: Iterating Using Java 8 —————————– Country:Japan […]

  • 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 […]

  • 05 September

    Java 8 Consumer example

    In this post, we are going to see about java 8 Consumer interface. Consumer is single argument functional interface like Predicate but it does not return any value. As Consumer is functional interface, so it can be used as assignment target for lambda expressions. Consumer definition Consumer takes single argument and do not return any […]

  • 05 September

    Java 8 Supplier example

    In this post, we are going to see about java 8 Supplier interface. Supplier is functional interface which does not take any argument and produces result of type T.It has a functional method called T get() As Supplier is functional interface, so it can be used as assignment target for lambda expressions. Here is source code […]

  • 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 […]

  • 03 September

    Java 8 Predicate example

    Java 8 predicate is functional interface introduced in java 8. Predicate definition Predicate is single argument functional interface which returns true or false. It takes one argument and returns result in form of true or false. [crayon-60066321d57dd767395898/] Here is the definition of Predicate interface. [crayon-60066321d57e1307788004/] Predicate methods example test() This is abstract method of Predicate […]