Posts

Showing posts from February, 2018

Java-8 Features

interface Formula {     double calculate(int a);     default double sqrt(int a) {         return Math.sqrt(a);     } } Formula formula = new Formula() {     @Override     public double calculate(int a) {         return sqrt(a * 100);     } }; formula.calculate(100);     // 100.0 formula.sqrt(16); List  names = Arrays.asList("peter", "anna", "mike", "xenia"); Collections.sort(names, new Comparator () {     @Override     public int compare(String a, String b) {         return b.compareTo(a);     } }); Collections.sort(names, (String a, String b) -> {     return b.compareTo(a); }); Collections.sort(names, (a, b) -> b.compareTo(a)); @FunctionalInterface interface Converter  {     T convert(F from); } Converter  converter = (from) -> Integer.valueOf(from); Integer converted = converter.conve...

Java-8 Tutorial

   lambda expression is a function:   (parameters) -> expression or     (parameters) -> { statements; } 1. (int x, int y) -> x + y                          // takes two integers and returns their sum 2. (x, y) -> x - y                                  // takes two numbers and returns their difference 3. () -> 42                                         // takes no values and returns 42 4. (String s) -> System.out.println(s)           // takes a string, prints its value to the console, and returns nothing 5. x -> 2 * x                                       // takes a number and re...

Primitive Wrapper Classes are Immutable in Java

All primitive wrapper classes (Integer, Byte, Long, Float, Double, Character, Boolean and Short ) are immutable in Java, so operations like addition and subtraction create a new object and not modify the old. // Java program to demonstrate that prmitive // wrapper classes are immutable class Demo {     public static void main(String[] args)     {         Integer i = new Integer(12);         System.out.println(i);         modify(i);         System.out.println(i);     }     private static void modify(Integer i)     {         i = i + 1;     } } Output : 12 12

Functional programming

Image

Difference between Design Pattern and Design Principle

Object Oriented Principle: Single Responsiblity Principle Open/Closed Principle Dependancy Principle Interface Segregation Principle OO principle is a set of guidelines that ensures OOP concept. Based on the OOP concept, this defines ways to design better way, a better design. The basic OO design principle is SOLID. A Design pattern provides a general solution to a design problem. Please note “design pattern” can be applied to noon object oriented word too. So A OO design patterns (OODPs) are those which provide a general solution to object oriented design based OO principle. Design patterns are discovered, not invented. There are several ways to define OODPs and most famous one is BSC [Behavioral Structural Creational]. Design Principle = SOLID (i.e. Dependency Inversion Principle) Design Pattern = Gof (i.e. Abstract Factory Pattern) Patterns are common solutions to object-oriented programming problems. Actually patterns based on principles *Design Principle : * Software design princi...

Functional Programming vs Impeaitive Programming

In computer science, functional programming is a programming paradigm—a style of building the structure and elements of computer programs—that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. In contrast, imperative programming changes state with commands in the source code,

Functional Programming in Javascript

Image

Functional Programming vs Object Oriented Programming

Image

how to avoid mutation in javascript

Image

difference between functional interface and marker interface in java, list some examples

SQL Cheet Sheet

Image

Regex Cheet Sheet

Image

Maven Cheet Sheet

Image

JVM Cheet Sheet

Image

Junit Cheet Sheet

Image

Git Cheet Sheet

Image

Java-8 Cheet Sheet

Image

Generics Cheet Sheet

Image

Docker Sheet Sheet

Image

Collections Cheet Sheet

Image

Java-9 Features

The Java SE 9 feature release includes both enhancements in Java SE 9 API or Technology aditions and changes in JDK 9. A Java Programmer interested in Oracle Certified Associate, Java SE 9 Programmer (OCAJP 9) and Oracle Certified Professional, Java SE 9 Programmer (OCPJP 8) Java 9 Certifications must know the following features and enhancements. Keep watching  MyExamCloud Java Certification  page about latest books, mock exams, practice tests for Java 9 OCAJP and OCPJP Certifications. Java 9 is an amazing new version of Java. This object-oriented programming language is still number one among others and you need to get more improvements from time to time. These improvements will allow you to take your apps to the next level right away. We will talk a little about Java 9 and what this new version of Java has in store for you. We will let you know about Java 9 module system, REPL which is used to test Java Constructs, Try with resources improvements, Process API changes, Factor...