SlideShare a Scribd company logo
Java 8 - New Features
NaveenHegde
Apr 2014
Java Version History
2
1996 1998 2000 2002 2004 2006 2011
Java SE 8
Spider
2014
First release developed
under the Java
Community Process
Version 1.5 -> 5
To reflect level of
Maturity, Stability
J2SE -> Java SE
Dropped .0
• Java 5
– Generics, Autoboxing
– Enhanced For-Loop, VarArgs and more…
Recap - Major Feature Additions in
Java
3
 Java 6
• Script Engine
• New I/O
• Jconsole, profiler & debug interface (JVMPI, JVMDI)
 Java 7
• Strings in Switch, Catch Multiple-Exceptions
• Try-with-Resource, Type Interface
• JVM Support for Non-Java Languages
• Lambda Expressions
• Streams Facility
• Date-Time Library
• permgen replaced by Metaspace
• Type Annotations and Repeating Annotations
• jdbc-odbc bridge removed
• New utilities to improve Performance, Scalability
Java SE 8 New Features at glance
4
• Treat functionality as method argument (code as data)
• Avoid anonymous inner class which seem excessive & unclear
• Cleaner way to implement Functional Interfaces
• Used to create anonymous methods
Lambda Expressions
5
Parameter(s)
Body
single expression or statement block
Lambda Expression Syntax
Sample Code for “Sorting persons array by Age”
Java compiler determines Lambda Expr Type using new “Target Typing” mechanism
• In Swing, JavaFX, Often, event handler interfaces are
functional interfaces
• Lambda expressions can best replace anonymous classes
created for keyboard actions, mouse actions etc
Using Lambda Expression in GUI
6
• Creation of compact, easy-to-read lambda expressions
• Use it with Lambda Expresions for
– Encapsulate a single unit of behavior and pass it to other code
– Create simple instance of a functional interface
Method References
7
Method Reference Type Example
to a static method Person::compareByAge
to an instance method of a particular object myComparator::compareByName
to a method of arbitrary type instance String::compareToIgnoreCase
to a constructor HashSet::new
• Ability to add default implementation in interfaces
• No impact on already existing implementations
Default Interface Method
8
 Extending Interfaces That Contain Default Methods
• Not mention default method -> inherits the default
• Redeclare the default method -> makes it abstract.
• Redefine the default method -> overrides it
Interface with all default methods is like an Adapter
• New package for filter/map/reduce transformations on streams
• Includes many useful built in aggregate operations
java.util.stream.*
9
int ave = Arrays.stream(personArr)
.filter(b -> b.getGender() == Gender.MALE)
.mapToDouble(Person::getSalary)
.average()
.getAsDouble();
‘persons’ is a Collection<Person>
 Generating Streams
• Collection objects: via the stream() and parallelStream() methods
• Array elements: via Arrays.stream(Object[])
• Lines of File : BufferedReader.lines()
• Streams of random numbers : Random.ints()
• No storage
– A stream is not a data structure that stores elements
– it conveys elements from a source (Array,Collection,IO Channel
etc) through a pipeline of computational operations
– stream operation produces a result without modifing its source
• Functional in nature
– Enable Functional way of Working with Databases – Easy and elegant
• Parallelism
– Streams facilitate parallel execution by reframing the computation as a
pipeline of aggregate operations
• Consumable
– The elements are visited only once during the life of a stream.
– new stream must be generated to revisit the same elements
Why use Streams?
10
• JavaSE 6
– Date
– Calendar
– DateFormat
– TimeZone
Date-Time Packages
11
 Java 8
formatter=DateTimeFormatter.ofPattern("yyyy MM dd");
String text = date.toString(formatter);
LocalDate date = LocalDate.parse(text, formatter)
ChronoUnit.DAYS.between(t1, t2)
• Motive
– Solve the common scalability problem of “Maintaining a single count, sum,
etc. that is updated by many threads”
• How?
– Internally employ contention-reduction techniques
– Provides huge throughput improvements as compared to Atomic variables
• Classes
– DoubleAccumulator
 One or more variables that together maintain a running double value updated using a
supplied function.
– DoubleAdder
 One or more variables that together maintain an initially zero double sum.
– LongAccumulator
– LongAdder
Scalable-Updatable variable support
12
• Streams & Lambda expression based new methods
– forEach methods
 forEach, forEachKey, forEachValue, and forEachEntry
– search methods
 search, searchKeys, searchValues, and searchEntries
– reduction methods
 reduce, reduceToDouble, reduceToLong …
ConcurrentHashMap Enhancements
13
-> ConcurrentHashMaps (and classes built from them) are more useful as cache
• Interfaces
– CompletionStage<T>: A stage of a possibly asynchronous computation
• Classes
– CompletableFuture<T>: A Future that may be explicitly completed
 May be used as a CompletionStage,
 Supports actions that trigger upon its completion
– CountedCompleter<T>: A ForkJoinTask with a completion Action
 Action is triggered when there are no remaining pending actions
– ConcurrentHashMap.KeySetView<K,V>:
 A view of ConcurrentHashMap as a Set of keys
 Additions may optionally be enabled by mapping to a common value
New Additions to java.util.concurrent
14
• Arrays.parallelSort()
– Parallel merge-sort algorithm technique using ForkJoinPool
• Bulk Data Operations for Collections
• Base64 Encoding & Decoding support
– New Classes
 Base64, Base64.Decoder, Base64.Encoder
– Eg Applications of use
 Multipurpose Internet Mail Extensions (MIME)
 encode passwords for HTTP headers
Utils
15
• StampedLock
– A capability-based lock with three modes for controlling access
 1) Reading 2) Writing 3) Optimistic Reading
– Lock acquisition methods return a stamp
– Stamp represents and controls access with respect to a lock state
– Designed for the development of thread-safe components
– Not re-entrant
• ForkJoinPool (since java7)
– ExecutorService for running ForkJoinTasks
– A static commonPool() is added to reduce resource usage
 Default pool appropriate for most applications
– ForkJoinPool differs from other kinds of ExecutorService
 Mainly by virtue of employing work-stealing
 All threads in the pool attempt to find and execute subtasks created by other tasks or external
clients like management and monitoring operations
Miscellaneous
16
• Repeating Annotations
– provide the ability to apply the same annotation type more than once to
the same declaration
• 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
Annotations
17
• Motive
– Eliminate need for ‘MaxPermSize’ tuning (one of the reasons for OOM error)
– Improve GC performance
• Removal of PermGen
– Most allocations for the class metadata is done out of native memory
– Some miscellaneous data has been moved to the Java heap
– klasses that were used to described class metadata have been removed
– Metaspace is Non-contigeous to heap
– A garbage collection may be induced to collect dead classloaders and classes. The
first garbage collection will be induced when the class metadata usage reaches
MaxMetaspaceSize
PermGen replaced by Metaspace
18
Heap
NewGen
Survivor Space
OldGen
PermGen
Heap
NewGen
Survivor Space
OldGen
Metaspace Native
Mem
PermGen=Region{
Class Metadata, Hierarchy info,
Constant Pool, Bytecode …}
No more “OutOfMemoryError:
PermGen space”
• Defines subsets of JRE for devices that have limited
storage capacity
• Match Application Functional needs closely
Compact Profiles
19
Security(E) JMX Instrumentation XML JAXP (E)
JDBC RMI XML JAXP
Core Networking IO Collections
Scripting Regex JNDI Reflection
Profile1
Profile2
CompactProfile3
FullSEAPI
Swing Beans Sound Image I/O Java 2D
CORBA JNI IDL Print Service AWT
• Lightweight, high-performance script engine
• Implemented in Java by Oracle
• Replaces Mozilla Rhino JavaScript interpreter
– Rhino compiled all JavaScript code to bytecode in generated class files.
– Compared to C implementation of Javascript run with JIT compilation,
Rhino had better performance
– Rhino had memory leak since most JVMs don’t clean unused classes
• Nashorn
– compiles scripts in memory and passes bytecode directly to JVM
Nashorn Javascript Engine
20
• Enriched 3D Graphics features
• New SwingNode class
– SwingNode - enables embedding Swing content into JavaFX
– ScheduledService - allows to automatically restart the service
• Enhanced text support
– Hindi and Thai controls
– New Styles - bi-directional text, multi-line etc
• Now Compatible with ARM platforms
Java FX
21
• The JDBC-ODBC Bridge has been removed
– Reason
 The JDBC-ODBC Bridge had been non-supported product
 Was provided with only selected JDKs and not included in JRE
– Alternate recommendation
 Use a JDBC driver provided by the database vendor
 If it was in use to with MS Access DB or Excel spreadsheet etc, could be replaced by
pure java DB like H2, Java DB etc.
• JDBC 4.2
– Minor enhancements to JDBC to improve usability and portability
• JDK 8 includes Java DB 10.10
– a version of the Apache Derby database (since Java 5)
JDBC
22
• URLPermission Represents permission to access
– a resource defined by url
– for a given set of user-settable request methods and request headers
• URLPermission(String url_name, String actions)
– name of the permission is the url string
 http://www.oracle.com/a/b/*
– actions string is a concatenation of the request methods and headers
 "POST,GET,DELETE“
 "POST,GET:Header1,Header2“
• Examples of Path Matching
– public boolean implies(Permission p)
HTTP URL Permission
23
This’s path P’s path Matches /implies
/a/b/* /a/b/c Yes
/a/b/* /a/b/c/d No
/a/b/- /a/b/c/d/e Yes
• KeyStore enhancements
– new Domain KeyStore type java.security.DomainLoadStoreParameter
– new command option - importpassword for the keytool utility
• New variant of AccessController.doPrivileged
– enables code to assert a subset of its privileges, without preventing the
full traversal of the stack to check for other permissions
• Support for
– Stronger algorithms for password-based encryption
– AEAD algorithms
– SHA-224 Message Digests
– rcache Types in Kerberos 5 Replay Caching
Security
24
• Leverage CPU Instructions for AES Cryptography
– Intel Westmere hardware (2010 or newer) has instruction set to
support AES (Advanced Encryption Standard)
– Syntax: -XX:+UseAES -XX:+UseAESIntrinsics
• JMC 5.3
– JMC (Originally developed by JRockit) is an advanced set of tools that
enabling efficient JVM monitoring & profiling
– JMC is bundled with the HotSpot JVM starting from Java SE 7u40
HotSpot VM
25
• New Commands
– Jjs – invoke Nashorn java script engine
– Java – can launch JavaFX
– Jdeps - analyze class files
• Pack200
– Pack200 support for Constant Pool Entries and New Bytecodes
Tools
26
Thank You
END
27
Ad

More Related Content

What's hot (20)

Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Emiel Paasschens
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8
Simon Ritter
 
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
Sanjoy Kumar Roy
 
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
Manav Prasad
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
Stephen Colebourne
 
Java 8 Features
Java 8 FeaturesJava 8 Features
Java 8 Features
Trung Nguyen
 
The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8
Takipi
 
Java SE 8 library design
Java SE 8 library designJava SE 8 library design
Java SE 8 library design
Stephen Colebourne
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8
icarter09
 
Java SE 8
Java SE 8Java SE 8
Java SE 8
Simon Ritter
 
Java 8
Java 8Java 8
Java 8
Sudipta K Paik
 
Smart Migration to JDK 8
Smart Migration to JDK 8Smart Migration to JDK 8
Smart Migration to JDK 8
Geertjan Wielenga
 
02 basic java programming and operators
02 basic java programming and operators02 basic java programming and operators
02 basic java programming and operators
Danairat Thanabodithammachari
 
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaJDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
Simon Ritter
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to Interfaces
Raffi Khatchadourian
 
New Features of JAVA SE8
New Features of JAVA SE8New Features of JAVA SE8
New Features of JAVA SE8
Dinesh Pathak
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
Lambdas : Beyond The Basics
Lambdas : Beyond The BasicsLambdas : Beyond The Basics
Lambdas : Beyond The Basics
Simon Ritter
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Emiel Paasschens
 
55 New Features in Java SE 8
55 New Features in Java SE 855 New Features in Java SE 8
55 New Features in Java SE 8
Simon Ritter
 
The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8The Dark Side Of Lambda Expressions in Java 8
The Dark Side Of Lambda Expressions in Java 8
Takipi
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
Lambda Expressions in Java 8
Lambda Expressions in Java 8Lambda Expressions in Java 8
Lambda Expressions in Java 8
icarter09
 
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaJDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
Simon Ritter
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to Interfaces
Raffi Khatchadourian
 
New Features of JAVA SE8
New Features of JAVA SE8New Features of JAVA SE8
New Features of JAVA SE8
Dinesh Pathak
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
Lambdas : Beyond The Basics
Lambdas : Beyond The BasicsLambdas : Beyond The Basics
Lambdas : Beyond The Basics
Simon Ritter
 

Similar to Java SE 8 - New Features (20)

Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
Digicomp Academy AG
 
Java8
Java8Java8
Java8
Felipe Mamud
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
Trisha Gee
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx France
Trisha Gee
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
Gal Marder
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rs
Sagara Gunathunga
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8
Kyle Smith
 
Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8
Simon Ritter
 
Java >= 9
Java >= 9Java >= 9
Java >= 9
Benjamin Pack
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
kunj desai
 
JavaOne 2011 Recap
JavaOne 2011 RecapJavaOne 2011 Recap
JavaOne 2011 Recap
Jim Bethancourt
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
marctritschler
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
Marc Tritschler
 
Lambdas in Java 8
Lambdas in Java 8Lambdas in Java 8
Lambdas in Java 8
Tobias Coetzee
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
harendra_pathak
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigou
jaxconf
 
Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)
Lucas Jellema
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
Ryan Cuprak
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
Martin Toshev
 
Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)Java 8 in Anger (QCon London)
Java 8 in Anger (QCon London)
Trisha Gee
 
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Lecture from javaday.bg by Nayden Gochev/ Ivan Ivanov and Mitia Alexandrov
Nayden Gochev
 
Java 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx FranceJava 8 in Anger, Devoxx France
Java 8 in Anger, Devoxx France
Trisha Gee
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
Gal Marder
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rs
Sagara Gunathunga
 
What's new in Java 8
What's new in Java 8What's new in Java 8
What's new in Java 8
Kyle Smith
 
Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8
Simon Ritter
 
JDBC Connectivity Model
JDBC Connectivity ModelJDBC Connectivity Model
JDBC Connectivity Model
kunj desai
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
marctritschler
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
Marc Tritschler
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
harendra_pathak
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigou
jaxconf
 
Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)
Lucas Jellema
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
Ryan Cuprak
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
Martin Toshev
 
Ad

Recently uploaded (20)

PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Ad

Java SE 8 - New Features

  • 1. Java 8 - New Features NaveenHegde Apr 2014
  • 2. Java Version History 2 1996 1998 2000 2002 2004 2006 2011 Java SE 8 Spider 2014 First release developed under the Java Community Process Version 1.5 -> 5 To reflect level of Maturity, Stability J2SE -> Java SE Dropped .0
  • 3. • Java 5 – Generics, Autoboxing – Enhanced For-Loop, VarArgs and more… Recap - Major Feature Additions in Java 3  Java 6 • Script Engine • New I/O • Jconsole, profiler & debug interface (JVMPI, JVMDI)  Java 7 • Strings in Switch, Catch Multiple-Exceptions • Try-with-Resource, Type Interface • JVM Support for Non-Java Languages
  • 4. • Lambda Expressions • Streams Facility • Date-Time Library • permgen replaced by Metaspace • Type Annotations and Repeating Annotations • jdbc-odbc bridge removed • New utilities to improve Performance, Scalability Java SE 8 New Features at glance 4
  • 5. • Treat functionality as method argument (code as data) • Avoid anonymous inner class which seem excessive & unclear • Cleaner way to implement Functional Interfaces • Used to create anonymous methods Lambda Expressions 5 Parameter(s) Body single expression or statement block Lambda Expression Syntax Sample Code for “Sorting persons array by Age” Java compiler determines Lambda Expr Type using new “Target Typing” mechanism
  • 6. • In Swing, JavaFX, Often, event handler interfaces are functional interfaces • Lambda expressions can best replace anonymous classes created for keyboard actions, mouse actions etc Using Lambda Expression in GUI 6
  • 7. • Creation of compact, easy-to-read lambda expressions • Use it with Lambda Expresions for – Encapsulate a single unit of behavior and pass it to other code – Create simple instance of a functional interface Method References 7 Method Reference Type Example to a static method Person::compareByAge to an instance method of a particular object myComparator::compareByName to a method of arbitrary type instance String::compareToIgnoreCase to a constructor HashSet::new
  • 8. • Ability to add default implementation in interfaces • No impact on already existing implementations Default Interface Method 8  Extending Interfaces That Contain Default Methods • Not mention default method -> inherits the default • Redeclare the default method -> makes it abstract. • Redefine the default method -> overrides it Interface with all default methods is like an Adapter
  • 9. • New package for filter/map/reduce transformations on streams • Includes many useful built in aggregate operations java.util.stream.* 9 int ave = Arrays.stream(personArr) .filter(b -> b.getGender() == Gender.MALE) .mapToDouble(Person::getSalary) .average() .getAsDouble(); ‘persons’ is a Collection<Person>  Generating Streams • Collection objects: via the stream() and parallelStream() methods • Array elements: via Arrays.stream(Object[]) • Lines of File : BufferedReader.lines() • Streams of random numbers : Random.ints()
  • 10. • No storage – A stream is not a data structure that stores elements – it conveys elements from a source (Array,Collection,IO Channel etc) through a pipeline of computational operations – stream operation produces a result without modifing its source • Functional in nature – Enable Functional way of Working with Databases – Easy and elegant • Parallelism – Streams facilitate parallel execution by reframing the computation as a pipeline of aggregate operations • Consumable – The elements are visited only once during the life of a stream. – new stream must be generated to revisit the same elements Why use Streams? 10
  • 11. • JavaSE 6 – Date – Calendar – DateFormat – TimeZone Date-Time Packages 11  Java 8 formatter=DateTimeFormatter.ofPattern("yyyy MM dd"); String text = date.toString(formatter); LocalDate date = LocalDate.parse(text, formatter) ChronoUnit.DAYS.between(t1, t2)
  • 12. • Motive – Solve the common scalability problem of “Maintaining a single count, sum, etc. that is updated by many threads” • How? – Internally employ contention-reduction techniques – Provides huge throughput improvements as compared to Atomic variables • Classes – DoubleAccumulator  One or more variables that together maintain a running double value updated using a supplied function. – DoubleAdder  One or more variables that together maintain an initially zero double sum. – LongAccumulator – LongAdder Scalable-Updatable variable support 12
  • 13. • Streams & Lambda expression based new methods – forEach methods  forEach, forEachKey, forEachValue, and forEachEntry – search methods  search, searchKeys, searchValues, and searchEntries – reduction methods  reduce, reduceToDouble, reduceToLong … ConcurrentHashMap Enhancements 13 -> ConcurrentHashMaps (and classes built from them) are more useful as cache
  • 14. • Interfaces – CompletionStage<T>: A stage of a possibly asynchronous computation • Classes – CompletableFuture<T>: A Future that may be explicitly completed  May be used as a CompletionStage,  Supports actions that trigger upon its completion – CountedCompleter<T>: A ForkJoinTask with a completion Action  Action is triggered when there are no remaining pending actions – ConcurrentHashMap.KeySetView<K,V>:  A view of ConcurrentHashMap as a Set of keys  Additions may optionally be enabled by mapping to a common value New Additions to java.util.concurrent 14
  • 15. • Arrays.parallelSort() – Parallel merge-sort algorithm technique using ForkJoinPool • Bulk Data Operations for Collections • Base64 Encoding & Decoding support – New Classes  Base64, Base64.Decoder, Base64.Encoder – Eg Applications of use  Multipurpose Internet Mail Extensions (MIME)  encode passwords for HTTP headers Utils 15
  • 16. • StampedLock – A capability-based lock with three modes for controlling access  1) Reading 2) Writing 3) Optimistic Reading – Lock acquisition methods return a stamp – Stamp represents and controls access with respect to a lock state – Designed for the development of thread-safe components – Not re-entrant • ForkJoinPool (since java7) – ExecutorService for running ForkJoinTasks – A static commonPool() is added to reduce resource usage  Default pool appropriate for most applications – ForkJoinPool differs from other kinds of ExecutorService  Mainly by virtue of employing work-stealing  All threads in the pool attempt to find and execute subtasks created by other tasks or external clients like management and monitoring operations Miscellaneous 16
  • 17. • Repeating Annotations – provide the ability to apply the same annotation type more than once to the same declaration • 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 Annotations 17
  • 18. • Motive – Eliminate need for ‘MaxPermSize’ tuning (one of the reasons for OOM error) – Improve GC performance • Removal of PermGen – Most allocations for the class metadata is done out of native memory – Some miscellaneous data has been moved to the Java heap – klasses that were used to described class metadata have been removed – Metaspace is Non-contigeous to heap – A garbage collection may be induced to collect dead classloaders and classes. The first garbage collection will be induced when the class metadata usage reaches MaxMetaspaceSize PermGen replaced by Metaspace 18 Heap NewGen Survivor Space OldGen PermGen Heap NewGen Survivor Space OldGen Metaspace Native Mem PermGen=Region{ Class Metadata, Hierarchy info, Constant Pool, Bytecode …} No more “OutOfMemoryError: PermGen space”
  • 19. • Defines subsets of JRE for devices that have limited storage capacity • Match Application Functional needs closely Compact Profiles 19 Security(E) JMX Instrumentation XML JAXP (E) JDBC RMI XML JAXP Core Networking IO Collections Scripting Regex JNDI Reflection Profile1 Profile2 CompactProfile3 FullSEAPI Swing Beans Sound Image I/O Java 2D CORBA JNI IDL Print Service AWT
  • 20. • Lightweight, high-performance script engine • Implemented in Java by Oracle • Replaces Mozilla Rhino JavaScript interpreter – Rhino compiled all JavaScript code to bytecode in generated class files. – Compared to C implementation of Javascript run with JIT compilation, Rhino had better performance – Rhino had memory leak since most JVMs don’t clean unused classes • Nashorn – compiles scripts in memory and passes bytecode directly to JVM Nashorn Javascript Engine 20
  • 21. • Enriched 3D Graphics features • New SwingNode class – SwingNode - enables embedding Swing content into JavaFX – ScheduledService - allows to automatically restart the service • Enhanced text support – Hindi and Thai controls – New Styles - bi-directional text, multi-line etc • Now Compatible with ARM platforms Java FX 21
  • 22. • The JDBC-ODBC Bridge has been removed – Reason  The JDBC-ODBC Bridge had been non-supported product  Was provided with only selected JDKs and not included in JRE – Alternate recommendation  Use a JDBC driver provided by the database vendor  If it was in use to with MS Access DB or Excel spreadsheet etc, could be replaced by pure java DB like H2, Java DB etc. • JDBC 4.2 – Minor enhancements to JDBC to improve usability and portability • JDK 8 includes Java DB 10.10 – a version of the Apache Derby database (since Java 5) JDBC 22
  • 23. • URLPermission Represents permission to access – a resource defined by url – for a given set of user-settable request methods and request headers • URLPermission(String url_name, String actions) – name of the permission is the url string  http://www.oracle.com/a/b/* – actions string is a concatenation of the request methods and headers  "POST,GET,DELETE“  "POST,GET:Header1,Header2“ • Examples of Path Matching – public boolean implies(Permission p) HTTP URL Permission 23 This’s path P’s path Matches /implies /a/b/* /a/b/c Yes /a/b/* /a/b/c/d No /a/b/- /a/b/c/d/e Yes
  • 24. • KeyStore enhancements – new Domain KeyStore type java.security.DomainLoadStoreParameter – new command option - importpassword for the keytool utility • New variant of AccessController.doPrivileged – enables code to assert a subset of its privileges, without preventing the full traversal of the stack to check for other permissions • Support for – Stronger algorithms for password-based encryption – AEAD algorithms – SHA-224 Message Digests – rcache Types in Kerberos 5 Replay Caching Security 24
  • 25. • Leverage CPU Instructions for AES Cryptography – Intel Westmere hardware (2010 or newer) has instruction set to support AES (Advanced Encryption Standard) – Syntax: -XX:+UseAES -XX:+UseAESIntrinsics • JMC 5.3 – JMC (Originally developed by JRockit) is an advanced set of tools that enabling efficient JVM monitoring & profiling – JMC is bundled with the HotSpot JVM starting from Java SE 7u40 HotSpot VM 25
  • 26. • New Commands – Jjs – invoke Nashorn java script engine – Java – can launch JavaFX – Jdeps - analyze class files • Pack200 – Pack200 support for Constant Pool Entries and New Bytecodes Tools 26