:::: MENU ::::
  • Write binary

    Write binary

  • Assemble binary

    Assemble binary

  • Contribute to binary universe

    Contribute to binary universe


  • May 27 / 2016
  • 0
Programming, Software development

Features of Java 8



Java 8 is released on 18 march 2014. It is the most awaited & major release of Java. There are dozens of new features added to Java Programming Language with this release. Along with these new features, lot of feature enhancements have been done under-the-hood, at both compiler and JVM level. Lets take a look at interesting language features.

Lambda Expression (λ)

  • A lambda expression is a block of code that you can pass around so it can be executed later, just once or multiple times.
  • Lambda expression facilitates functional programming.
  • It simplifies the development a lot.
  • Important characteristics of lambda expression:
    • Optional type declaration
    • Optional parenthesis
    • Optional curly braces
    • Optional return keyword
parameter -> expression body
(a, b)  ->  a + b;


Functional Interfaces

  • Functional interfaces have a single functionality to exhibit.
  • An interface is a functional interface if it defines exactly one abstract method.
  • A new annotation, @FunctionalInterface, has been introduced.
  • Java 8 has defined a lot of functional interfaces to be used extensively in lambda expressions in java.util.function package.
  • A lambda expression can be supplied whenever an object of an interface with a single abstract method is expected.


Method References

  • Method reference allows to reference constructors or methods without executing them.
  • Method references help to point to methods by their names.
  • A method reference is described using :: (double colon) symbol.
  • Method reference is used when lambda expression does nothing but call and existing method.
  • A method reference can be used to point the following types of methods:
    • Static methods
    • Instance methods
    • Constructors using new operator 
x -> System.out.println(x);

(x, y) -> x.compareToIgnoreCase(y);


Default Methods

  • Default method provides default implementation of a methods in interfaces.
  • Default methods enable to add new functionalities to interfaces without breaking the classes that implements that interface.
  • Default methods provide the most elegant and practical way to allow backwards compatibility.
  • This capability is added so that old interfaces can be used to leverage the lambda expression capability of Java 8.
  • Interfaces can have static default methods as well.
interface Person {
     default String getName() { return “Om"; }




  • Stream represents a sequence of objects from a source, which supports many parallel operations to process the data, while completely abstracting out the low level multithreading logic.
  • A stream gets/computes elements on demand. It never stores the elements.
  • Stream takes Collections, Arrays, or I/O resources as input source.
  • Stream supports aggregate operations like filter, map, limit, reduce, find, match, and so on.
  • Most of the stream operations return stream itself so that their result can be pipelined.
  • Collection interface has two methods to generate a Stream.
    • stream() − Returns a sequential stream considering collection as its source.
    • parallelStream() − Returns a parallel Stream considering collection as its source.
List<String> strings = Arrays.asList("abc", "", "bc", "efg", "abcd","", "jkl"); 

List<String> filtered = strings.stream().filter(string -> !string.isEmpty()).collect(Collectors.toList());



  • Optional is a container object which may or may not contain a non-null value.
  • Optional object is used to represent null with absent value.
  • This class has various utility methods to facilitate code to handle values as ‘available’ or ‘not available’ instead of checking null values.
  • Optional class provides variety of methods to cure some of the problems of NullPointerExceptions.
  • You can use lambda expression while using Optional class.
Optional optionalString=Optional.ofNullable(optionalTest.getNullString()); 



Nashorn JavaScript

  • Nashorn, a much improved javascript engine is introduced in JAVA 8 similar to V8 engine provided by chrome over which Node.js runs.
  • It enables us to run javascript to run on a  jvm.
  • It is compatible with Node.js applications while also allowing actual Java libraries to be called by the javascript code running on server.
  • JAVA 8 introduces a new command line tool, jjs, to execute javascript codes at console.
  • Using ScriptEngineManager, JavaScript code can be called and interpreted in Java.


New Date/Time API

  • Java 8 introduces a new date-time API under the package java.time.
  • It allows easy timezone handling with help of domain specific design.
  • It introduced two important super classes to deal with problems.
  • Local: Simplified date-time API with no complexity of time zone handling.
  • Zoned: Specialized date-time API to deal with various time zones.
  • New API now supports Joda Time.
  • Most of the classes are immutable and threadsafe.
  • The new API prefers enums over integer constants for things like months and days of the week.
ZoneId zone = ZoneId.systemDefault(); 
Clock clock = Clock.system(zone); 

long time = clock.millis();
  • Jan 30 / 2016
  • 0

Don’t work hard, work smart, why not both?


Working very hard but not very productive at your work, did you introspect why? You are always very busy at work but you always have things left to do at end of the day. Is staying very busy means very productive? Do you waste your time at work? A very old and common saying to above problems is WORK SMART NOT HARD. But what if we do both & say WORK SMART WHILE WORKING HARD. Below are the 5 practices which can help you work SMART while working HARD.

1. Set goals

It is very important to set your goals first for whatever you do, but I will say first set smaller goals. It is always good to set big goals for whatever you do, but it is very important to divide it into small ones to meet the big ones effectively. Set goals for everyday, every week and every month and at the end check whether you have reached your goals or not or how far are you away from meeting them? Meeting your smaller goals on time helps you to meet your big goals on or before time. So setting smaller goals is the first step to get your things done.

2. Use tools

Do you use tools for your day to day work? If not start using them from now. Tools help you to organize your works, set priorities and get your things done on time. It helps you keep track on progress of small things and visible progress motivates you to pick the next task. It also helps you in reminding the pending things to do and keep the progress going. There are many tools available like One Note, Evernote where you can manage your TODOs for day to day work. I personally prefer to use Google Keep as it perfectly fits into my need. You can choose other various tools available as per your preference. Either it is office or home, make a habit of using tools.

3. Stay focused

You must devote your entire focus to the task in your hand. Keep your cellphone away (out of sight and silent), try to close unnecessary open browser windows and most importantly stay away from social networking sites. Use headphone and listen to music if you like it (I prefer to use headphone with no music which helps me in concentrating). You must concentrate on the current task and forget about any other important task until you are done with the current one. Try to get all the required things (water, coffee etc) near you before starting your work to avoid any distraction while doing it. And most importantly, try to avoid any unplanned meetings during your work if it is not very important.

4. Learn to say no

Remember, you are a human being and you cannot do all things at a time. Decide priority of works coming to you and learn to say NO to other work which has less priority and not relevant to getting your thing done. If you make a lot of commitments for the same time then you will end up juggling between them instead of actually doing them. Make sure you say NO very politely and make your reasons clear. This is good if you accept more works but then try to set the right priority for them and you should avoid doing multiple things at one time.

5. Learn to delegate

Some people think that only they can do things in a right way but It sounds very arrogant. One should learn to delegate the work to the team members. Again remember, you are a human being and you cannot do all the things at one time. You should keep your ego aside and take time to train someone, who knows if he/she does work correctly and even can do it in a better and a faster way than you. You should accept it and learn to trust others. You should not feel incompetent or ashamed because you need help for something.

  • Dec 24 / 2015
  • 0
Software development

5 things to check before doing Agile

Are you ready?

Getting very popular in recent days, every small and big IT companies are going Agile for their software development process. Are they all really doing agile? Do they face problems while doing agile? Are they ready to do the agile? Is agile easy or complex? Is agile successful for all? There are so many similar kind of questions arise when you think of doing agile. There are some practical problems which may turn into not a successful agile. Here are the 5 most important things which should make sure before jumping in to agile.

1. Know and understand agile

Agile is not only about the deliveries in iteration. It is much much more than this. It is a process, it is a practice, it is a development methodology and more. It is very important to know and understand the agile very well before planning to get into it. It is important to check if agile fits into your need. You should just not do the agile because everyone else is doing it. So know and understand agile first and then make sure you are ready with necessary prerequisites before jumping into it.

2. All stakeholders are ready to accept agile

A project is driven by multiple stakeholders and all stakeholders have same responsibilities for a successful project. It is important that every stakeholder knows & understands agile. They should respect the agile disciplines and should be ready to help the agile team in case of impediments. They should happily accept the demands of agile and always ready for making it a success.

3. Team is trained on agile

Agile team is most important player in complete agile process. We know that a trained team delivers better so if you are thinking of going into agile, it is very important that your team is trained on agile processes. They should know all rules, disciplines and benefits of following them. It can be a big mistake if you jump into agile with an untrained team.

4. Team is cross functional or motivated to be cross functional

This is one of the very common issue in agile. Agile demands for a cross functional team who can help each other in any kind of work and take the responsibilities of other team members with different skill sets. If you are starting with agile, so it is not uncommon that you don´t have a cross functional team ready, but important is your team is ready and motivated to be cross functional.

5. Infrastructure and tools are available for agile

Infrastructure and tools help team in following the agile rules and become more disciplined and connected. Good, quick and smooth coordination is one of the key requirements of agile. Infrastructure and tools facilitate team to communicate with each other efficiently and reaching the goal in controlled manner. Make sure your team is equipped with necessary (if not all) infrastructure and tools to work flawlessly.

I am reachable Contact me