:::: MENU ::::

Posts Categorized / Software development

  • 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();
  • 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