Category java 8

Depth-first search algorithm

Depth-first search algorithm

Depth-first search (DFS) is a search algorithm that explores the search tree by going as deep as possible along each branch before backtracking. This means that it explores each branch of the search tree as far as possible before moving…

Breadth-first search algorithm

breadth-first search

The breadth-first search (BFS) algorithm is a search algorithm that explores the search tree by visiting all of the nodes at the same depth before moving on to the next level. This means that it visits all of the nodes…

Default and static methods of Interface in Java 8 example

Java 8 Introduces interfaces with default and static methodsInterface:package org.interfaces; public interface MyInterface { //Abstarct method      public void printSomeThing();             //static method static void callMe() { System.out.println(“Called Static method of My interface!”); }   …

Lambda expression example in java 8

Functional Interface:  An interface with only one abstract methodpackage org.lamda; @FunctionalInterfacepublic interface Fun { public void makeFun(String f);} Lambda Expression: (->)  Lambda expressions are anonymous functions, we can pass as a parameter to a function instead of object. package org.lamda;…

Enable Notifications OK No thanks