Posts

Showing posts from January, 2017

Functional Programming in JAVA

JAVA 8 release is the package of all surprises, functional programming is one among them. Let's explore a bit on functional programming style in java... Functional programming is the natural successor to Object Oriented programming.The objective of the design of the FPL is to mimic mathematical functions to the greatest extent possible. Will start with examples for functional programming in java Normally if we want to write any functions say addition of two numbers we were following below approach: public int add(int x,int y) {    return x+y; } The above piece of code can be written in FP style like Function<Integer,Integer> adder = (x,y)->x+y; Where Function belongs to the package  java.util.function General prototype     java.util.function.Function<T,R>      where T is input datatype, R is return data type. Java has one more Interface called  BinaryOperator under  java.util.function  which ...

Password Manager

Image
We deal with passwords everyday and it is very important to have a strong password now a days. So here is the sample application created by me (Yeah! during boring time 😜) Hope you guys will like it!. Initial Screen:- This is the startup screen which allows you to enter environment and username of the credential after entering details click on Generate Password. Password generated ;- Here you are allowed to store generated password with username and environment details locally in desktop so that you can get it at any time. It also allows you to change password format that gets generated so that you can make it even more complicated. This application was developed using Java SE using NetBeans editor You can find source code in git  link Happy Coding :)

Lambda expression in Java - A new way of coding

Image
How it looks if we have functionality of passing the method implementation as a parameter?Awesome isn't it? Yeah now we can do this magic in Java through Lambda expression.Oracle recently included Lambda expression in Java as a part of Java 8 release. So let's explore few things about Lambda expression in Java. A lambda expression is like syntactic sugar for an anonymous class with one method whose type is inferred.  Syntax :  The main syntax of a lambda expression is “parameters -> body”. The compiler can usually use the  context of the lambda expression to determine the functional interfac e  being used and the types of  the parameters. There are four important rules to the syntax: Declaring the types of the parameters is optional. Using parentheses around the parameter is optional if you have only one parameter. Using curly braces is optional (unless you need multiple statements). The “return” keyword is optional if you have a sing...