• 20 September

    Find length of Linked List in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm programs. In this post, we will see how to find length of Linked List in java. You can obviously use size() method of java Linked List class but here we are going to see how to find length […]

  • 20 September

    Implement singly linked list in java

    In this post, we will see how to implement singly linked list in java. It is one of the most used data structure. In singly linked list, Node has data and pointer to next node. It does not have pointer to the previous node. Last node ‘s next points to null, so you can iterate […]

  • 16 September

    Java Program to Find Missing Number in An Array

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. 1. Overview In this article, we will see how to find missing number in Array of 1 to n. This is one of basic coding interview question asked in my interviews. 2. Introduction to Problem Statement […]

  • 15 September

    Longest Common Prefix in an array of Strings in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we are going to see longest common prefix in array of Strings. So lets say you have string array as below: [crayon-67439dac80062532811531/] So Longest common prefix in above String array will be “java” […]

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

  • 10 September

    Implement stack using Linked List in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this program, we will see how to implement stack using Linked List in java. The Stack is an abstract data type that demonstrates Last in first out (LIFO) behavior. We will implement the same behavior using […]

  • Java 8 forEach example
    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-67439dac80354646323580/] Improved way of iterating HashMap in java 8: [crayon-67439dac80357824881134/] When you run above program, you will get below output: Iterating Using Java 8 —————————– Country:Japan […]

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

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