Why Java 8 ?

With this new release, Java 8 is introducing a completely new JVM with full packed of some really exciting features at both the JVM and programming language level.

There are literally dozens of new features that make java even better than previous versions and improvement about performance and optimized coding level with some functional programming features. These additions are under-the-hood improvements either at the compiler, JVM or help-system level.

  • Lambda Expression and Virtual Extension Methods are the highlighting feature of Java 8 which is the implementation of Lambda expressions and supporting features to the Java programming language and platform.
  • To overcome external iteration, Java 8 Stream API was introduced. We can use Java Stream API to implement internal iteration.
  • To use lambda expression, we need to create either our own functional interface or we can use pre-defined functional interface provided by Java-8 with @FunctionalInterface.


  • Java 8 introduced forEach() and forEachOrdered() method to iterate over Collection and streams.
  • Internal iterationprovides several features such as sequential and parallel execution with multithreaded environment.
  • Stream operations have two functional characteristics: 

                                           i) Pipelining and ii) Internal Iteration

  • Java 8 added new Optional type gives developers most significant flexibility when dealing with null values, which reduces the likelihood of NullPointerExceptions.
  • In many cases, Java 8 will improve application performance without any specific work or tuning by using multithreaded environment.
  • Java 8 new Date and Time API will allow developers to handle date and time in a more efficient and natural way.
  • A new JavaScript engine “Nashhorn” is integrated with Java 8. When we integrate JS into backend that we don’t worthier about setting up node.js instance, we can simply use JVM to execute the code.
  • Concurrent Accumulators enable you to very efficiently increase / decrease the value of a counter in a thread safe manner. This is really a case where it’s not a question of taste, or preference – using these new classes in your code is really a no-brainer.
  • Java 8 provides Improved Security which replaces the existing hand-maintained list of caller sensitive methods with a mechanism that accurately identifies those methods and it allows its callers to be discovered reliably.
  • Aggregate operations:Streams support SQL-like operations and common operations from functional programing languages, such as filter, map, reduce, find, match, sorted, and so on.
  • In Java 8 , staticand default keyword to create interfaces with method implementation. forEach method implementation in Iterable interface is:

default void forEach(Consumer<? super T> action) {
for (T t : this) {

Since, Java doesn’t provide multiple inheritance in class level because it leads  to Diamond Problem. So how it will be handled with interfaces now, since interfaces are now similar to abstract classes.

  • parallelSort() method introduces with the multi threaded concept which makes it much faster than previous sorting methods. The parallel sort uses Fork/Join framework.
  • Java 8 has introduced  forEach method in lang.Iterable interface so that while writing code developers only focus on business logic only.
  • The :: operator is used to make method reference to separate the Class and Object from the method name.

[code lang=”java”]
Eg: str -> System.out.println(str)

  • A Part of these improvements java 8 improves some miscellaneous core API improvements Like:
    • ThreadLocal static method withInitial(Supplier supplier) to create instance easily.
    • min(), max() and sum() added in Integer, Long and double wrapper classes.
    • logicalAnd(), logicalOr() and logicalXor() methods in Boolean classes.
    • To invoke javascript “Nashrom” engine jjs command is added.
    • For Zip file entries, ZipFile.stream() method to get an ordered stream over zip file entries
    • Various utility methods added in Math class.
    • Comparator interface extended with a lot of default and static methods for natural ordering or reverse order etc.
    • To analyze class files a new command “jdeps” has been added.
    • JDBC-ODBC bridge and PermGen (Permanent Generation) memory space has been removed.
    • jis command is added to invoke Nashorn Engine.


  1. I am a computer science student so its very important to have good command on Java. I once opened this code-adda.com during my exams and it was really helpful. This site is so such informative that one does not need to open books for looking up for the core concepts. It covers everything from basic to advance java.The quality of examples given are aplaudable. MCQs are also given related to every concept that too not the basic questions but some high level ones where you need to use your brain. The site layout is also good and according to me layout doesnt matter if the content provided is too awsome. Moreover learning here is completely free , so no need to take up any extra couse for JAVA , it has vey useful content. Not even Java but it provides courses on other languages also which I didnt study but what study was remarkable and that is JAVA. The laguauge used is also easy to understand and every point is made clear by giving proper example.


1 Trackback / Pingback

  1. Concurrency in Java 8 - Code-Adda

Leave a Reply