Java 8 New Features
Java 8 or JDK 1.8 is the most significant expansion of the Java language yet. Java 8's new features such as Lambda Expressions, Stream APIs, Nashorn, Compact Profiles, new Time APIs increase the expressive power of the platform and make it easier for developers to take advantage of modern, multicore processors. This article gives an overview of the new features in Java 8 with links to in-depth tutorials for the most important of them. New Features in Java 8
- Lambda ExpressionsRead tutorial on Java 8 Lambda Expressions enable you to treat functionality as a method argument, or code as data. Lambda expressions let you express instances of single-method interfaces (referred to as Functional InterfacesClick to Read tutorial on Java 8 Functional Interfaces) more compactly.
- Method referencesRead tutorial on Java 8 Method References provide easy-to-read lambda expressions for methods that already have a name. Constructor ReferencesRead Java 8 Constructor References Tutorial are the equivalent forms of representation for constructors.
- Default methodsRead tutorial on Java 8 Default Methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces.
- With default methods in Java 8, multiple inheritance of behaviorClick to Read tutorial explaining multiple inheritance in Java 8 is now possible in Java, and it is important to understand the conflict resolution rulesClick to Read tutorial on multiple inheritance conflict resolution which resolve Diamond Problem and other conflict scenarios.
- Java 8’s new package java.util.functionClick to Read overview of java.util.function package provides many useful functional interfaces for the most common scenarios. The 4 most important functional interface among them are - PredicateClick to Read tutorial on Predicate Functional Interface, ConsumerClick to read tutorial on Consumer Functional Interface, FunctionClick to read tutorial on Function Interface and SupplierClick to read tutorial on Supplier Functional Interface.
- Repeating AnnotationsRead tutorial on Java 8 Repeating Annotations provide the ability to apply the same annotation type more than once to the same declaration or type use.
java.util.streampackage provides a new Streams API Read Java 8 Streams API tutorial to support functional-style operations on streams of elements. The Stream API is integrated into the Collections API.
- Java 8's new Collector interfaceClick to Read Tutorial explaining basics of Java 8 Collectors and its multiple predefined implementations provide an efficient way to terminate the Stream operations and collect the result in a collection.
- A new Date-Time packageClick to read Overview & linked tutorials on new Date-Time API -
java.time- with a new comprehensive set of date and time utilities.
- Java 8’s new enhanced methods in Collections API are covered in a series of 4 tutorials - Iterable.forEach() & Iterator.remove()Read Java 8 Collection Enhancements- Part 1, Collection.removeIf()Read Java 8 Collection Enhancements- Part 2, List.sort() & List.replaceAll()Read Java 8 Collection Enhancements- Part 3, and new multi-value mapRead Java 8 Collection Enhancements- Part 4 methods.
- Java 8 has introduced new internal iteratorsClick to Read tutorial on Java 8's Internal Iterators based on declarative functional programming style.
- Comparator interface has undergone a major upgrade in Java 8 with new methods leveraging Java 8's functional programming features, comparator chaining, in-built null handling, and many more such features. Java 8 Comparator tutorialClick to Read The Complete Java 8 Comparator Tutorial covers these new features in depth.
- Standard Encoding and Decoding Base64,Parallel Array Sorting and Unsigned Arithematic Support.
- JDBC 4.2 with new features and notably the JDBC-ODBC bridge has been removed.
- Concurrency related important changes which include -
- Changes to ConcurrentHashMap to support aggregate operations based on the newly added streams facility and lambda expression.
- Addition of classes to the java.util.concurrent.atomic package to support scalable updatable variables.
- Support for a common pool in ForkJoinPool.
StampedLockclass to to provide a capability-based lock with three modes for controlling read/write access
- Type Annotations provide the ability to apply an annotation anywhere a type is used, not just on a declaration. Used with a pluggable type system, this feature enables improved type checking of your code.
- Improved Type Inference and Method Parameter Reflection.
- Compact Profiles contain predefined subsets of the Java SE platform and enable applications that do not require the entire Platform to be deployed and run on small devices.
- Improved internationalization including support for Unicode 6.2.0, new Calendar and Locale APIs, Adoption of Unicode CLDR Data and the java.locale.providers System Property and Ability to Install a Custom Resource Bundle as an Extension.
- In case you are interesting in knowing about the best books on Java 8 then you can read the Reviews of 5 Best Books on Java 8Click to Read Reviews of Best Java 8 Books.