Thursday, 29 November 2018

They have a logical index, yes - effectively the number of times you need to iterate, starting from the head, before getting to that node. it can't directly search using index of the object Typically O(1) access by index is performed by using an array lookup, and in the case of a linked list there isn't an array - there's just a chain of nodes. To access a node with index N, you need to start at the head and walk...

Function Interface  Java.util.function has special interface like bleow, it contains generic methods used as type for lambda expression with same type and signature. An interface with exactly one abstract method is called Functional Interface. @FunctionalInterface annotation is added so that we can mark an interface as functional interface.  If  we try to have more than one abstract method, it throws compiler...

Wednesday, 28 November 2018

Angular CLI Useful Commands ng g component my-new-component ng g directive my-new-directive ng g pipe my-new-pipe ng g service my-new-service ng g class my-new-class ng g guard my-new-guard ng g interface my-new-interface ng g enum my-new-enum ng g module my-module Create components. Template, component and js file will be generated with...

To generate new component employee. Go to app root in CLI and run below command ng g c employee/create-employee --spec=false --flat=true ng g c employee/list-employees --spec=false --flat=true component.ts, html and css files will be genarated in employee folder in app and it will add List Employee and Create Employee components...

Tuesday, 27 November 2018

define AngularJS? AngularJS is an open-source JavaScript framework designed for creating dynamic single web page applications with fewer lines of code.  What is Angular 2? Angular is a framework to build large scale and high performance web application while keeping them as easy-to-maintain. Components − The earlier version of Angular had a focus of Controllers but now has changed the focus to having components over...

Friday, 23 November 2018

Need to remove common number 4 from both arrays Input int[] arr1 = { 1, 4, 6, 7, 8 }; int[] arr2 = { 2, 4, 5, 9, 0 }; Output int[] arr1 = { 1, 6, 7, 8 }; int[] arr2 = { 2, 5, 9, 0 }; RemoveCommonElements.java public class RemoveCommonElements { public static void main(String[] args) { RemoveCommonElements app = new RemoveCommonElements(); app.commonRemove(); } private void commonRemove() { int[] arr1 = { 1,...

When Parent throws Generic Exception and Child throws specific exception Compiles and run successfully public class Animal { public void eat() throws Exception { System.out.println("Animal Eating..."); } } public class Cat extends Animal { @Override public void eat() throws FileNotFoundException { System.out.println("Cat Eating ....."); } } public class App { public static void main(String[] args)...

Thursday, 22 November 2018

Java Object class comes with native clone() method that returns the copy of the existing instance. To use java object clone method, we have to implement the marker interface java.lang.Cloneable so that it won’t throw CloneNotSupportedException at runtime. Also Object clone is a protected method, so we will have to override it to use with other classes Student.java public class Student implements Cloneable { private int...

Thursday, 15 November 2018

Structural design patterns are concerned with how classes and objects can be composed, to form larger structures.The structural design patterns simplifies the structure by identifying the relationships.These patterns focus on, how the classes inherit from each other and how they are composed from other classes. Adapter Pattern  An Adapter Pattern says that just "converts the interface of a class into another interface...
Page 1 of 101234567...10Next »Last

Search This Blog

Contact us

Name

Email *

Message *