SlideShare a Scribd company logo
1 of 95
Java 8:
Create The Future
Jim Weaver
Java Technology Ambassador
@JavaFXpert
james.weaver@oracle.com
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.2
Program Agenda
 Java SE 8: Enhancing the Core Java Platform
 Java ME 8: Building The Internet of Things
 NetBeans 8: The IDE For Java 8
 Where Next?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3
About the presenter
Author of several Java/JavaFX books
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4
About the presenter
Co-leader of IoT & JavaFX communities at java.net
javafxcommunity.com
iotcommunity.net
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5
Java 8 Launch Event & Resource Videos
oracle.com/java8
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6
IoT Developer Challenge
 Show the world what you can do with Java + IoT for a chance to win a
trip to JavaOne for you and two team members.
oracle.com/java8
Key Dates:
Submissions begin March 3rd, 2014
Submission deadline is May 30th, 2014
Winners announced June 30th, 2014
JavaOne 2014 from Sept. 28 to Oct. 2, 2014
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7
Java SE 8:
Enhancing The Core Java
Platform
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8
A simple lambda example – event handling
Handling the Zoom Gesture (ZoomEvent)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9
Lambda Expressions
 Almost all machines now are multi-core, multi-processor, or both
 We need to make it simpler to write multi-threaded Java code
– Java has always had the concept of threads
– Even using the concurrency utilities and fork-join framework this is hard
 Let’s add better library code
– This is good, but sometimes we need to change the language too
 The answer: Lambda expressions and the streams API
Why Do We Need Them?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10
The Problem: External Iteration
List<Student> students = ...
double highestScore = 0.0;
for (Student s : students) {
if (s.gradYear == 2011) {
if (s.score > highestScore) {
highestScore = s.score;
}
}
}
• Client controls iteration
• Inherently serial: iterate from
beginning to end
• Not thread-safe because
business logic is stateful
(mutable accumulator
variable)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11
Internal Iteration With Inner Classes
 Iteration, filtering and
accumulation are handled by the
library
 Not inherently serial – traversal
may be done in parallel
 Traversal may be done lazily –
so one pass, rather than three
 Thread safe – client logic is
stateless
 High barrier to use
– Syntactically ugly
List<Student> students = ...
double highestScore = students.stream().
filter(new Predicate<Student>() {
public boolean test(Student s) {
return s.getGradYear() == 2011;
}
}).
mapToDouble(new ToDoubleFunction<Student>() {
public Double applyAsDouble(Student s) {
return s.getScore();
}
}).
max();
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12
Internal Iteration With Lambdas
SomeList<Student> students = ...
double highestScore = students.stream().
filter(Student s -> s.getGradYear() == 2011).
mapToDouble(Student s -> s.getScore()).
max();
• More readable
• More abstract
• Less error-prone
• No reliance on mutable state
• Easier to make parallel
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13
Lambda Expressions
 Lambda expressions represent anonymous functions
– Like a method, has a typed argument list, a return type, a set of thrown
exceptions, and a body
– Not associated with a class
 We now have parameterized behaviour, not just values
Some Details
double highestScore = students.stream().
filter(Student s -> s.getGradYear() == 2011)
mapToDouble(Student s -> s.getScore())
max();
What
How
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14
Lambda Expressions
 Definition
– A functional interface is an interface with only one abstract method
– However, the interface may have more than one method
 Identified structurally
– Type is inferred from the context
– Works for both assignment and method parameter contexts
 The type of a Lambda expression is a functional interface
– Instances of functional interfaces are created with Lambda expressions
– @FunctionalInterface annotation
Functional Interfaces
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15
Internal Iteration With Lambdas
filter(Student s -> s.getGradYear() == 2011)
 The type of this lambda is the Predicate functional interface
 The lambda expression is an implementation of the test() method.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16
Type Inferrence
List<String> ls = getList();
Collections.sort(ls, (String x, String y) -> x.length() - y.length());
Collections.sort(ls, (x, y) -> x.length() - y.length());
static T void sort(List<T> l, Comparator<? super T> c);
 The compiler can often infer parameter types in a Lambda expression
 Inferrence uses the target functional interface’s method signature
 Fully statically typed (no dynamic typing sneaking in)
– More typing with less typing
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.17
Lambda Epressions
• Lambda expressions can refer to effectively final local variables from
the enclosing scope
– This means a variable behaves as if it is marked final (even if it is not)
– The variable is assigned once
• Lambda expressions are anonymous functions
– They are not associated with an object
– this will refer to the object in the surrounding scope
Local Variable Capture & Lexical Scoping
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
void createUI() {
Button button = new Button("Guess What I'm Thinking");
button.setOnAction(e -> guess(e)); // lambda only calls a method
...
}
void guess(ActionEvent event) {
Button button = (Button) event.getSource();
button.setText("You love Lambda!");
}
If a lambda only calls a method …
Method References
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.19
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
… you can use a method reference
void createUI() {
Button button = new Button("Guess What I'm Thinking");
button.setOnAction(this::guess); // use method reference
...
}
void guess(ActionEvent event) {
Button button = (Button) event.getSource();
button.setText("You love Lambda!");
}
Method References
If a lambda only calls a method,
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.20
Method References
• Method references let us reuse a method as a lambda expression
FileFilter x = (File f) -> f.canRead();
FileFilter x = File::canRead;
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.21
Constructor References
 Same concept as a method reference
– For the constructor
Factory<List<String>> f = ArrayList<String>::new;
Factory<List<String>> f = () -> return new ArrayList<String>();
Equivalent to
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.22
2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Four Kinds of Method References
1) Reference to a static method:
ContainingClass::staticMethodName
2) Reference to an instance method of a particular object:
ContainingObject::instanceMethodName
3) Reference to an instance method of an arbitrary object of a particular type:
ContainingType::methodName
4) Reference to a constructor:
ClassName::new
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.23
Default Methods
 Provide a mechanism to add new methods to existing interfaces
– Without breaking backwards compatability
– Gives Java multiple inheritance of behaviour, as well as types
 but not state!
public interface Set<T> extends Collection<T> {
... // The existing Set methods
default Spliterator<E> spliterator() {
return Spliterators.spliterator(this, Spliterator.DISTINCT);
}
}
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.24
Static Methods In Interfaces
 Previously it was not possible to include static methods in an interface
 Static methods, by definition, are not abstract
– @FunctionalInterface can have zero or more static methods
static <T> Predicate<T> isEqual(Object target) {
return (null == target)
? Objects::isNull
: object -> target.equals(object);
}
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.25
Streams API
 Most business logic is about aggregate operations
– “Most profitable product by region”
– “Group transactions by currency”
 As we have seen, up to now, Java mostly uses external iteration
– Inherently serial
– Frustratingly imperative
 Java SE 8’s answer: Streams
– With help from Lambdas
Aggregate Operations
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.26
Stream Overview
 Abstraction for specifying aggregate computations
– Not a data structure
– Can be infinite
 Simplifies the description of aggregate computations
– Exposes opportunities for optimization
– Fusing, laziness and parallelism
High Level
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.27
Stream Overview
 A stream pipeline consists of three types of things
– A source
– Zero or more intermediate operations
– A terminal operation
 Producing a result or a side-effect
Pipeline
int sum = transactions.stream().
filter(t -> t.getBuyer().getCity().equals(“London”)).
mapToInt(Transaction::getPrice).
sum();
Source
Intermediate operation
Terminal operation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.28
Stream Overview
 The filter and map methods don’t really do any work
– They set up a pipeline of operations and return a new Stream
 All work happens when we get to the sum() operation
– filter()/map()/sum() fused into one pass on the data
 For both sequential and parallel pipelines
Execution
int sum = transactions.stream().
filter(t -> t.getBuyer().getCity().equals(“London”)). // Lazy
mapToInt(Transaction::getPrice). // Lazy
sum(); // Execute the pipeline
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.29
Stream Sources
 From collections and arrays
– Collection.stream()
– Collection.parallelStream()
– Arrays.stream(T array) or Stream.of()
 Static factories
– IntStream.range()
– Files.walk()
 Roll your own
– java.util.Spliterator()
Many Ways To Create
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.30
Stream Sources
 Access to stream elements
 Decomposition (for parallel operations)
– Fork-join framework
 Stream characteristics (See Spliterator javadoc)
– ORDERED
– DISTINCT
– SORTED
– SIZED
– SUBSIZED
– NONNULL
– IMMUTABLE
– CONCURRENT
Manage Three Aspects
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.31
Stream Intermediate Operations
 Uses lazy evaluation where possible
 Can affect stream characteristics
– map() preserves SIZED but not DISTINCT or SORTED
 Some operations fuse/convert to parallel better than others
– Stateless operations (map, filter) fuse/convert perfectly
– Stateful operations (sorted, distint, limit) fuse/convert to varying
degrees
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.32
Stream Terminal Operations
 Invoking a terminal operation executes the pipeline
– All operations can execute sequentially or in parallel
 Terminal operations can take advantage of pipeline characteristics
– toArray() can avoid copying for SIZED pipelines by allocating in
advance
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.33
Optional<T>
 Indicates that reference may, or may not have a value
– Makes developer responsible for checking
– A bit like a stream that can only have zero or one elements
Reducing NullPointerException Occurences
Optional<GPSData> maybeGPS = Optional.of(gpsData);
maybeGPS = Optional.ofNullable(gpsData);
maybeGPS.ifPresent(GPSData::printPosition);
GPSData gps = maybeGPS.orElse(new GPSData());
maybeGPS.filter(g -> g.lastRead() < 2).ifPresent(GPSData.display());
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.34
java.util.function Package
 Predicate<T>
– Determine if the input of type T matches some criteria
 Consumer<T>
– Accept a single input argumentof type T, and return no result
 Function<T, R>
– Apply a function to the input type T, generating a result of type R
 Plus several more
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.35
Stream Example 1
Convert words in list to upper case
List<String> output = wordList.
stream().
map(String::toUpperCase).
collect(Collectors.toList());
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.36
Stream Example 2
Find words in list with even length
List<String> output = wordList.
stream().
filter(w -> (w.length() & 1 == 0).
collect(Collectors.toList());
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.37
Stream Example 3
 BufferedReader has new method
– Stream<String> lines()
Count lines in a file
long count = bufferedReader.
lines().
count();
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.38
Stream Example 4
Find the length of the longest line in a file
int longest = reader.
lines().
mapToInt(String::length).
max().
getAsInt();
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.39
Stream Example 5
Collect all words in a file into a list
List<String> output = reader.
lines().
flatMap(line -> Stream.of(line.split(REGEXP))).
filter(word -> word.length() > 0).
collect(Collectors.toList());
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.40
Stream Example 6
List of words lowercased, in aphabetical order
List<String> output = reader.
lines().
flatMap(line -> Stream.of(line.split(REGEXP))).
filter(word -> word.length() > 0).
map(String::toLowerCase).
sorted().
collect(toList());
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.41
Annotations On Java Types
 Annotations can currently only be used on type declarations
– Classes, methods, variable definitions
 Extension for places where types are used
– e.g. parameters
 Permits error detection by pluggable type checkers
– e.g. null pointer errors, race conditions, etc
public void process(@notnull List data) {…}
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.42
Concurrency Updates
 Scalable update variables
– DoubleAccumulator, DoubleAdder, etc
– Multiple variables avoid update contention
– Good for frequent updates, infrequent reads
 ConcurrentHashMap updates
– Improved scanning support, key computation
 ForkJoinPool improvements
– Completion based design for IO bound applications
– Thread that is blocked hands work to thread that is running
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.43
Parallel Array Sorting
 Additional utility methods in java.util.Arrays
– parallelSort (multiple signatures for different primitives)
 Anticipated minimum improvement of 30% over sequential sort
– For dual core system with appropriate sized data set
 Built on top of the fork-join framework
– Uses Doug Lea’s ParallelArray implementation
– Requires working space the same size as the array being sorted
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.44
Date And Time APIs
 A new date, time, and calendar API for the Java SE platform
 Supports standard time concepts
– Partial, duration, period, intervals
– date, time, instant, and time-zone
 Provides a limited set of calendar systems and be extensible to others
 Uses relevant standards, including ISO-8601, CLDR, and BCP47
 Based on an explicit time-scale with a connection to UTC
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.45
Base64 Encoding and Decoding
 Currently developers are forced to use non-public APIs
– sun.misc.BASE64Encoder
– sun.misc.BASE64Decoder
 Java SE 8 now has a standard way
– java.util.Base64.Encoder
– java.util.Base64.Decoder
– encode, encodeToString, decode, wrap methods
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.46
Nashorn JavaScript Engine
 Lightweight, high-performance JavaScript engine
– Integrated into JRE
 Use existing javax.script API
 ECMAScript-262 Edition 5.1 language specification compliance
 New command-line tool, jjs to run JavaScript
 Internationalised error messages and documentation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.47
Removal Of The Permanent Generation
 No more need to tune the size of it
 Current objects moved to Java heap or native memory
– Interned strings
– Class metadata
– Class static variables
 Part of the HotSpot, JRockit convergence
Permanently
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.48
JavaFX 8
New Theme
4
Caspian
vs
Modena
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.49
4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Modena
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.50
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Modena
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.51
JavaFX 8
 Customisable
– Configurable key combinations to exit full screen mode
– Ability to prevent user exiting full screen mode
Improvements To Full Screen Mode
// Set the key combination that the user can use to exit
stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);
// Setup the click handler so we can escape from full screen
Rectangle r = new Rectangle(0, 0, 250, 250);
r.setOnMouseClicked(e -> stage.setFullScreen(false));
// Set full screen again
stage.setFullScreen(true);
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.52
JavaFX 8
 New API for printing
– Currently only supported on desktop
 Any node can be printed
Printing Support
PrinterJob job = PrinterJob.createPrinterJob(printer);
job.getJobSettings().setPageLayout(pageLayout);
job.getJobSettings().setPrintQuality(PrintQuality.HIGH);
job.getJobSettings().setPaperSource(PaperSource.MANUAL);
job.getJobSettings().setCollation(Collation.COLLATED);
if (job.printPage(someRichText))
job.endJob();
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.53
JavaFX 8
 DatePicker
 TreeTableView
New Controls
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.54
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The JavaFX DatePicker is designed with the new
Calendaring APIs in Java 8 using java.time
DatePicker
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.55 55
DatePicker
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.56
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
DatePicker
import java.time.LocalDate; // From new Date/Time API
...
LocalDate ld;
DatePicker dp = new DatePicker();
dp.setOnAction(e -> {
ld = dp.getValue();
System.out.println("Date selected " + ld);
});
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.57
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Date Picker
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.58
TreeTableView
UI control with combined TreeView and TableView controls functionality
58
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.59
JavaFX 8
 Gestures
– Swipe
– Scroll
– Rotate
– Zoom
 Touch events and touch points
Touch Support
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.60
Touch Gestures
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.61
Handling Touch (TouchEvent/TouchPoint)
 A TouchEvent contains information about
a touch, including:
– Event type: Pressed, released, moved, or
stationary
– Touch points: The TouchPoint instances
that represent each of the points that were
touched
 Each TouchEvent has a unique ID to identify the
events and touch points in a multi-touch action
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.62
Responding to Touch Events
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.63
JavaFX 8
 Predefined shapes
– Box
– Cylinder
– Sphere
 User-defined shapes
– TriangleMesh, MeshView
 PhongMaterial
 Lighting
 Cameras
3D Support
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.64 64
Creating Primitive Shapes and Materials
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.65
Placing a Texture on a Sphere
65
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.66
Placing a Texture on a Sphere
66
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.67
3D Lights
■ Lights are nodes in the scene graph
■ PointLight
■ AmbientLight
■ Default light provided if no active lights
67
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.68 68
Lights, Camera, Action!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.69
Example 3D multi-touch app:
ZenGuitar3D
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.70
Compact Profiles
Approximate static footprint goals
Compact1 Profile
Compact2 Profile
Compact3 Profile
Full JRE 54Mb
30Mb
16Mb
11Mb
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.71
Java SE Embedded
 Optimised binary for embedded use from devices to gateways
 Latest Java innovations in the smallest footprint
 Use of compact profiles
– Approximate JRE size 20.4Mb (ARM v7 VFS, Hard Float)
 Compact profile 1: 10.4Mb
 JavaFX: 10Mb
 Production ready binary for popular platforms that run Linux
– ARM v6/7 with Hard floating point
– Raspberry Pi is one of the reference platforms
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.72
Java ME 8:
Building The Internet of
Things
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.73
Java ME 8 Focus
Java ME EmbeddedJava Card
SECURITY SMALL EMBEDDED MEDIUM EMBEDDED LARGE EMBEDDED DESKTOP SERVER
50KB-1MB
1MB-10MB
10MB-100MB
Footprint
Java SE Embedded
Java Embedded Suite
Oracle Event Processing Embedded
100MB+
Java SE
ARM Cortex M3/M4
ARM Cortex-A
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.74
Java ME 8 Platform Overview
Java VM
Additional
APIs
(Examples)
Java ME Connected Limited Device Configuration (CLDC) 8 (JSR 360)
Additional
Optional APIs
On-Device I/O
Access
Vertical Specific
APIs
Location
Messaging
Wireless
Communication
Web Services
Protocols and
Data Conversion
Sensors
Additional
Optional JSRs
Security and
Management
Use Case Software
(e.g. smart pen)
Use Case Software
(e.g. wireless module)
Use Case Software
(e.g. control unit)
Use Case Software
(e.g. smart meter)
Application Platform
Java ME Embedded Profile
(MEEP) 8 (JSR 361)
On-Device I/O
Access
Device I/O
API
SATSA
(JSR 177)
Security and Trust
Services
Generic Connection
Framework
GCF 8
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.75
Java ME 8 Key Features
 Aligned with Java SE 8
– Language, libraries, VM
 Designed for embedded
– Fully headless operation
– Remote software provisioning and management
 Highly portable and scalable
– Minimum RAM footprint of 1Mb
 Consistent across devices
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.76
Java ME 8 Key Features
 Advanced application platform
– Multi-application model
 Modularised software services
– Faster and more flexible software development and deployment
 Multi-client domains (“partitioning”)
– Different clients can have different security domains
 Access to peripheral devices (Device I/O API)
 Compatible with JCP/JSR standard APIs
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.77
Connected Limited Device Configuration 8
Language Alignment with SE 8
VM Alignment with SE 8
Library Alignment with SE 8
Compact Configuration for very small devices
GCF 8 to provides flexible networking
Developer leverage of tools, APIs and knowledge
CLDC 8 Key Features
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.78
Generic Connection Framework 8
 SecureServerConnection
 SecureDatagramConnection
 ModemConnection
 UDPMulticastConnection
 CommConnection
 HttpConnection
 HttpsConnection
 SecureConnection
 ServerSocketConnection
 SocketConnection
 UDPDatagramConnection
Substantially Increased Range of Connection Types
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.79
MEEP 8
Java ME Embedded Profile (MEEP) 8
Architecture
CLDC 8
javax.
microedition.
midlet
NEW
UPDATED
javax.
microedition.
io
(optional)
javax.
microedition.
event
(optional)
javax.
microedition.
key
(optional)
javax.
microedition.
lui
(optional)
javax.
microedition.
media
(optional)
javax.
microedition.
power
(optional)
javax.
microedition.
rms
(optional)
javax.
microedition.
swm
(optional)
javax.
microedition.
cellular
(optional)
Application or Service
Application or Service
Application or Service
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.80
NetBeans 8:
The IDE For Java 8
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.81
Tools for Java SE 8
 Quickly convert
anonymous
inner
classes
to lambdas
Lambda Expressions
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.82
Tools for Java SE 8
 Static analysis
to ensure
safe transformation,
automatically
add cast
for correct type
Lambda Expressions
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.83
Tools for Java SE 8
 Editor support for
functional
operations
over collections
Internal Iterators via Java 8 Streams
1
2
3
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.84
Tools for Java SE 8
 Smoothly convert
to internal iterators
via hints and tips
Internal Iterators via Java 8 Streams
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.85
Tools for Java SE 8
 Quickly add explicit
parameter types for
readability
Explicit Parameter Types For Lambda Expressions
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.86
Tools for Java SE 8
 Easily convert
from lambdas
to method references
Method References
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.87
Tools for Java SE 8
 Specify a scope
for upgrading to Java 8
– All/current projects
– Specific package
– Specific class
 Run converters
 Visually preview
proposals for
refactoring
Refactoring in Batch Mode
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.88
Tools for Java SE Embedded 8
 Full Development Cycle support
against a remote platform
– Intuitive development
– One-click deploy
– Remote debugging
– Comprehensive remote profiling
 Complete end to end integration
for Raspberry Pi and other
embedded devices,
– e.g.Web Services.
Seamless Integration
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.89
Tools for Java ME Embedded 8
 Java ME 8 CLDC
Platform Emulator
 Intuitive tools and editors
for JDK 8 on Java ME
 Simple customization
of optional packages
Seamless Integration
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.90
Where Next?
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.91
Java 8
Learn More & Resources
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.92
Conclusions
 Java SE 8 adds powerful new features to the core
– Lambda expressions, streams and functions
– New controls, stylesheet and 3D support in JavaFX
 Java ME 8 focused on embedded development
– Device I/O APIs
 NetBeans 8, ready for Java 8 development
– Lambda support, embedded support
 Java continues to evolve
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.93
Java 9 And Beyond
 Modularisation of the Java platform
– Project Jigsaw
 Foreign function interface
– Like JNI
 Enhanced volatiles
Java Never Stops
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.94
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.95

More Related Content

What's hot

JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...Jorge Hidalgo
 
The Art of Metaprogramming in Java
The Art of Metaprogramming in Java  The Art of Metaprogramming in Java
The Art of Metaprogramming in Java Abdelmonaim Remani
 
JAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) BridgeJAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) BridgeJosé Paumard
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Arun Gupta
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorialsunniboy
 
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013Arun Gupta
 
JSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksJSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksDmitry Kornilov
 
GlassFish BOF
GlassFish BOFGlassFish BOF
GlassFish BOFglassfish
 
Ajax Basics 1
Ajax Basics 1Ajax Basics 1
Ajax Basics 1bhuvanann
 
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFish
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFishBatch Applications for Java Platform 1.0: Java EE 7 and GlassFish
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFishArun Gupta
 
Spring - Part 3 - AOP
Spring - Part 3 - AOPSpring - Part 3 - AOP
Spring - Part 3 - AOPHitesh-Java
 
Ajax Basics 2
Ajax Basics 2Ajax Basics 2
Ajax Basics 2bhuvanann
 
Sling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak KhetawatSling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak KhetawatAEM HUB
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015Pavel Bucek
 
JavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkJavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkStephen Chin
 
Adam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAdam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAjax Experience 2009
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Hirofumi Iwasaki
 

What's hot (20)

JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
JavaOne 2014 - CON2013 - Code Generation in the Java Compiler: Annotation Pro...
 
The Art of Metaprogramming in Java
The Art of Metaprogramming in Java  The Art of Metaprogramming in Java
The Art of Metaprogramming in Java
 
JAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) BridgeJAX-RS and CDI Bike the (Reactive) Bridge
JAX-RS and CDI Bike the (Reactive) Bridge
 
Hibernate Advance Interview Questions
Hibernate Advance Interview QuestionsHibernate Advance Interview Questions
Hibernate Advance Interview Questions
 
Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5Java EE 7: Boosting Productivity and Embracing HTML5
Java EE 7: Boosting Productivity and Embracing HTML5
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
Java EE 7: Whats New in the Java EE Platform @ Devoxx 2013
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
JSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworksJSONB introduction and comparison with other frameworks
JSONB introduction and comparison with other frameworks
 
GlassFish BOF
GlassFish BOFGlassFish BOF
GlassFish BOF
 
Ajax Basics 1
Ajax Basics 1Ajax Basics 1
Ajax Basics 1
 
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFish
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFishBatch Applications for Java Platform 1.0: Java EE 7 and GlassFish
Batch Applications for Java Platform 1.0: Java EE 7 and GlassFish
 
Spring - Part 3 - AOP
Spring - Part 3 - AOPSpring - Part 3 - AOP
Spring - Part 3 - AOP
 
Ajax Basics 2
Ajax Basics 2Ajax Basics 2
Ajax Basics 2
 
Sling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak KhetawatSling Models Using Sightly and JSP by Deepak Khetawat
Sling Models Using Sightly and JSP by Deepak Khetawat
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015WebSocket in Enterprise Applications 2015
WebSocket in Enterprise Applications 2015
 
JavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring FrameworkJavaFX 2 Using the Spring Framework
JavaFX 2 Using the Spring Framework
 
Adam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAdam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And Mashups
 
Future of Java EE with Java SE 8
Future of Java EE with Java SE 8Future of Java EE with Java SE 8
Future of Java EE with Java SE 8
 

Similar to What's New in Java 8

Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8IndicThreads
 
Functional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritterFunctional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritterSimon Ritter
 
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterLambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterJAXLondon2014
 
Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Simon Ritter
 
Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3Simon Ritter
 
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...jaxLondonConference
 
Lambdas : Beyond The Basics
Lambdas : Beyond The BasicsLambdas : Beyond The Basics
Lambdas : Beyond The BasicsSimon Ritter
 
Lambdas & Streams
Lambdas & StreamsLambdas & Streams
Lambdas & StreamsC4Media
 
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 JavaSimon Ritter
 
Lambdas Hands On Lab
Lambdas Hands On LabLambdas Hands On Lab
Lambdas Hands On LabSimon Ritter
 
Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Simon Ritter
 
JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJavaDayUA
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014Nayden Gochev
 
Lambdas And Streams Hands On Lab
Lambdas And Streams Hands On LabLambdas And Streams Hands On Lab
Lambdas And Streams Hands On LabSimon Ritter
 
Lambdas And Streams Hands On Lab, JavaOne 2014
Lambdas And Streams Hands On Lab, JavaOne 2014Lambdas And Streams Hands On Lab, JavaOne 2014
Lambdas And Streams Hands On Lab, JavaOne 2014Simon Ritter
 
What's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - WeaverWhat's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - WeaverCodemotion
 

Similar to What's New in Java 8 (20)

Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8
 
Apouc 2014-java-8-create-the-future
Apouc 2014-java-8-create-the-futureApouc 2014-java-8-create-the-future
Apouc 2014-java-8-create-the-future
 
Functional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritterFunctional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritter
 
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterLambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
 
Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Lambdas And Streams in JDK8
Lambdas And Streams in JDK8
 
Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3Lambdas and-streams-s ritter-v3
Lambdas and-streams-s ritter-v3
 
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
 
Lambdas : Beyond The Basics
Lambdas : Beyond The BasicsLambdas : Beyond The Basics
Lambdas : Beyond The Basics
 
Lambdas & Streams
Lambdas & StreamsLambdas & Streams
Lambdas & Streams
 
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
 
Lambdas Hands On Lab
Lambdas Hands On LabLambdas Hands On Lab
Lambdas Hands On Lab
 
Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8Improved Developer Productivity In JDK8
Improved Developer Productivity In JDK8
 
JShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java PlatformJShell: An Interactive Shell for the Java Platform
JShell: An Interactive Shell for the Java Platform
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
 
Lambdas And Streams Hands On Lab
Lambdas And Streams Hands On LabLambdas And Streams Hands On Lab
Lambdas And Streams Hands On Lab
 
Lambdas And Streams Hands On Lab, JavaOne 2014
Lambdas And Streams Hands On Lab, JavaOne 2014Lambdas And Streams Hands On Lab, JavaOne 2014
Lambdas And Streams Hands On Lab, JavaOne 2014
 
JDK8 Streams
JDK8 StreamsJDK8 Streams
JDK8 Streams
 
Completable future
Completable futureCompletable future
Completable future
 
What's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - WeaverWhat's new for JavaFX in JDK8 - Weaver
What's new for JavaFX in JDK8 - Weaver
 
Java 8
Java 8Java 8
Java 8
 

More from javafxpert

Machine Learning Exposed!
Machine Learning Exposed!Machine Learning Exposed!
Machine Learning Exposed!javafxpert
 
Raspberry Pi with Java 8
Raspberry Pi with Java 8Raspberry Pi with Java 8
Raspberry Pi with Java 8javafxpert
 
Autonomous Drone Development with Java and IoT
Autonomous Drone Development with Java and IoTAutonomous Drone Development with Java and IoT
Autonomous Drone Development with Java and IoTjavafxpert
 
J-Fall 2014 Community Keynote by Oracle
J-Fall 2014 Community Keynote by OracleJ-Fall 2014 Community Keynote by Oracle
J-Fall 2014 Community Keynote by Oraclejavafxpert
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFXjavafxpert
 
Asean dev-days-slides
Asean dev-days-slidesAsean dev-days-slides
Asean dev-days-slidesjavafxpert
 

More from javafxpert (7)

Machine Learning Exposed!
Machine Learning Exposed!Machine Learning Exposed!
Machine Learning Exposed!
 
Java 101
Java 101Java 101
Java 101
 
Raspberry Pi with Java 8
Raspberry Pi with Java 8Raspberry Pi with Java 8
Raspberry Pi with Java 8
 
Autonomous Drone Development with Java and IoT
Autonomous Drone Development with Java and IoTAutonomous Drone Development with Java and IoT
Autonomous Drone Development with Java and IoT
 
J-Fall 2014 Community Keynote by Oracle
J-Fall 2014 Community Keynote by OracleJ-Fall 2014 Community Keynote by Oracle
J-Fall 2014 Community Keynote by Oracle
 
Scratching the Surface with JavaFX
Scratching the Surface with JavaFXScratching the Surface with JavaFX
Scratching the Surface with JavaFX
 
Asean dev-days-slides
Asean dev-days-slidesAsean dev-days-slides
Asean dev-days-slides
 

Recently uploaded

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 

Recently uploaded (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 

What's New in Java 8

  • 1. Java 8: Create The Future Jim Weaver Java Technology Ambassador @JavaFXpert james.weaver@oracle.com
  • 2. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.2 Program Agenda  Java SE 8: Enhancing the Core Java Platform  Java ME 8: Building The Internet of Things  NetBeans 8: The IDE For Java 8  Where Next?
  • 3. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.3 About the presenter Author of several Java/JavaFX books
  • 4. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.4 About the presenter Co-leader of IoT & JavaFX communities at java.net javafxcommunity.com iotcommunity.net
  • 5. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.5 Java 8 Launch Event & Resource Videos oracle.com/java8
  • 6. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.6 IoT Developer Challenge  Show the world what you can do with Java + IoT for a chance to win a trip to JavaOne for you and two team members. oracle.com/java8 Key Dates: Submissions begin March 3rd, 2014 Submission deadline is May 30th, 2014 Winners announced June 30th, 2014 JavaOne 2014 from Sept. 28 to Oct. 2, 2014
  • 7. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.7 Java SE 8: Enhancing The Core Java Platform
  • 8. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.8 A simple lambda example – event handling Handling the Zoom Gesture (ZoomEvent)
  • 9. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.9 Lambda Expressions  Almost all machines now are multi-core, multi-processor, or both  We need to make it simpler to write multi-threaded Java code – Java has always had the concept of threads – Even using the concurrency utilities and fork-join framework this is hard  Let’s add better library code – This is good, but sometimes we need to change the language too  The answer: Lambda expressions and the streams API Why Do We Need Them?
  • 10. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.10 The Problem: External Iteration List<Student> students = ... double highestScore = 0.0; for (Student s : students) { if (s.gradYear == 2011) { if (s.score > highestScore) { highestScore = s.score; } } } • Client controls iteration • Inherently serial: iterate from beginning to end • Not thread-safe because business logic is stateful (mutable accumulator variable)
  • 11. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.11 Internal Iteration With Inner Classes  Iteration, filtering and accumulation are handled by the library  Not inherently serial – traversal may be done in parallel  Traversal may be done lazily – so one pass, rather than three  Thread safe – client logic is stateless  High barrier to use – Syntactically ugly List<Student> students = ... double highestScore = students.stream(). filter(new Predicate<Student>() { public boolean test(Student s) { return s.getGradYear() == 2011; } }). mapToDouble(new ToDoubleFunction<Student>() { public Double applyAsDouble(Student s) { return s.getScore(); } }). max();
  • 12. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.12 Internal Iteration With Lambdas SomeList<Student> students = ... double highestScore = students.stream(). filter(Student s -> s.getGradYear() == 2011). mapToDouble(Student s -> s.getScore()). max(); • More readable • More abstract • Less error-prone • No reliance on mutable state • Easier to make parallel
  • 13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.13 Lambda Expressions  Lambda expressions represent anonymous functions – Like a method, has a typed argument list, a return type, a set of thrown exceptions, and a body – Not associated with a class  We now have parameterized behaviour, not just values Some Details double highestScore = students.stream(). filter(Student s -> s.getGradYear() == 2011) mapToDouble(Student s -> s.getScore()) max(); What How
  • 14. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.14 Lambda Expressions  Definition – A functional interface is an interface with only one abstract method – However, the interface may have more than one method  Identified structurally – Type is inferred from the context – Works for both assignment and method parameter contexts  The type of a Lambda expression is a functional interface – Instances of functional interfaces are created with Lambda expressions – @FunctionalInterface annotation Functional Interfaces
  • 15. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.15 Internal Iteration With Lambdas filter(Student s -> s.getGradYear() == 2011)  The type of this lambda is the Predicate functional interface  The lambda expression is an implementation of the test() method.
  • 16. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.16 Type Inferrence List<String> ls = getList(); Collections.sort(ls, (String x, String y) -> x.length() - y.length()); Collections.sort(ls, (x, y) -> x.length() - y.length()); static T void sort(List<T> l, Comparator<? super T> c);  The compiler can often infer parameter types in a Lambda expression  Inferrence uses the target functional interface’s method signature  Fully statically typed (no dynamic typing sneaking in) – More typing with less typing
  • 17. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.17 Lambda Epressions • Lambda expressions can refer to effectively final local variables from the enclosing scope – This means a variable behaves as if it is marked final (even if it is not) – The variable is assigned once • Lambda expressions are anonymous functions – They are not associated with an object – this will refer to the object in the surrounding scope Local Variable Capture & Lexical Scoping
  • 18. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.18 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. void createUI() { Button button = new Button("Guess What I'm Thinking"); button.setOnAction(e -> guess(e)); // lambda only calls a method ... } void guess(ActionEvent event) { Button button = (Button) event.getSource(); button.setText("You love Lambda!"); } If a lambda only calls a method … Method References
  • 19. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.19 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. … you can use a method reference void createUI() { Button button = new Button("Guess What I'm Thinking"); button.setOnAction(this::guess); // use method reference ... } void guess(ActionEvent event) { Button button = (Button) event.getSource(); button.setText("You love Lambda!"); } Method References If a lambda only calls a method,
  • 20. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.20 Method References • Method references let us reuse a method as a lambda expression FileFilter x = (File f) -> f.canRead(); FileFilter x = File::canRead;
  • 21. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.21 Constructor References  Same concept as a method reference – For the constructor Factory<List<String>> f = ArrayList<String>::new; Factory<List<String>> f = () -> return new ArrayList<String>(); Equivalent to
  • 22. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.22 2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Four Kinds of Method References 1) Reference to a static method: ContainingClass::staticMethodName 2) Reference to an instance method of a particular object: ContainingObject::instanceMethodName 3) Reference to an instance method of an arbitrary object of a particular type: ContainingType::methodName 4) Reference to a constructor: ClassName::new
  • 23. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.23 Default Methods  Provide a mechanism to add new methods to existing interfaces – Without breaking backwards compatability – Gives Java multiple inheritance of behaviour, as well as types  but not state! public interface Set<T> extends Collection<T> { ... // The existing Set methods default Spliterator<E> spliterator() { return Spliterators.spliterator(this, Spliterator.DISTINCT); } }
  • 24. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.24 Static Methods In Interfaces  Previously it was not possible to include static methods in an interface  Static methods, by definition, are not abstract – @FunctionalInterface can have zero or more static methods static <T> Predicate<T> isEqual(Object target) { return (null == target) ? Objects::isNull : object -> target.equals(object); }
  • 25. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.25 Streams API  Most business logic is about aggregate operations – “Most profitable product by region” – “Group transactions by currency”  As we have seen, up to now, Java mostly uses external iteration – Inherently serial – Frustratingly imperative  Java SE 8’s answer: Streams – With help from Lambdas Aggregate Operations
  • 26. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.26 Stream Overview  Abstraction for specifying aggregate computations – Not a data structure – Can be infinite  Simplifies the description of aggregate computations – Exposes opportunities for optimization – Fusing, laziness and parallelism High Level
  • 27. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.27 Stream Overview  A stream pipeline consists of three types of things – A source – Zero or more intermediate operations – A terminal operation  Producing a result or a side-effect Pipeline int sum = transactions.stream(). filter(t -> t.getBuyer().getCity().equals(“London”)). mapToInt(Transaction::getPrice). sum(); Source Intermediate operation Terminal operation
  • 28. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.28 Stream Overview  The filter and map methods don’t really do any work – They set up a pipeline of operations and return a new Stream  All work happens when we get to the sum() operation – filter()/map()/sum() fused into one pass on the data  For both sequential and parallel pipelines Execution int sum = transactions.stream(). filter(t -> t.getBuyer().getCity().equals(“London”)). // Lazy mapToInt(Transaction::getPrice). // Lazy sum(); // Execute the pipeline
  • 29. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.29 Stream Sources  From collections and arrays – Collection.stream() – Collection.parallelStream() – Arrays.stream(T array) or Stream.of()  Static factories – IntStream.range() – Files.walk()  Roll your own – java.util.Spliterator() Many Ways To Create
  • 30. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.30 Stream Sources  Access to stream elements  Decomposition (for parallel operations) – Fork-join framework  Stream characteristics (See Spliterator javadoc) – ORDERED – DISTINCT – SORTED – SIZED – SUBSIZED – NONNULL – IMMUTABLE – CONCURRENT Manage Three Aspects
  • 31. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.31 Stream Intermediate Operations  Uses lazy evaluation where possible  Can affect stream characteristics – map() preserves SIZED but not DISTINCT or SORTED  Some operations fuse/convert to parallel better than others – Stateless operations (map, filter) fuse/convert perfectly – Stateful operations (sorted, distint, limit) fuse/convert to varying degrees
  • 32. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.32 Stream Terminal Operations  Invoking a terminal operation executes the pipeline – All operations can execute sequentially or in parallel  Terminal operations can take advantage of pipeline characteristics – toArray() can avoid copying for SIZED pipelines by allocating in advance
  • 33. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.33 Optional<T>  Indicates that reference may, or may not have a value – Makes developer responsible for checking – A bit like a stream that can only have zero or one elements Reducing NullPointerException Occurences Optional<GPSData> maybeGPS = Optional.of(gpsData); maybeGPS = Optional.ofNullable(gpsData); maybeGPS.ifPresent(GPSData::printPosition); GPSData gps = maybeGPS.orElse(new GPSData()); maybeGPS.filter(g -> g.lastRead() < 2).ifPresent(GPSData.display());
  • 34. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.34 java.util.function Package  Predicate<T> – Determine if the input of type T matches some criteria  Consumer<T> – Accept a single input argumentof type T, and return no result  Function<T, R> – Apply a function to the input type T, generating a result of type R  Plus several more
  • 35. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.35 Stream Example 1 Convert words in list to upper case List<String> output = wordList. stream(). map(String::toUpperCase). collect(Collectors.toList());
  • 36. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.36 Stream Example 2 Find words in list with even length List<String> output = wordList. stream(). filter(w -> (w.length() & 1 == 0). collect(Collectors.toList());
  • 37. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.37 Stream Example 3  BufferedReader has new method – Stream<String> lines() Count lines in a file long count = bufferedReader. lines(). count();
  • 38. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.38 Stream Example 4 Find the length of the longest line in a file int longest = reader. lines(). mapToInt(String::length). max(). getAsInt();
  • 39. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.39 Stream Example 5 Collect all words in a file into a list List<String> output = reader. lines(). flatMap(line -> Stream.of(line.split(REGEXP))). filter(word -> word.length() > 0). collect(Collectors.toList());
  • 40. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.40 Stream Example 6 List of words lowercased, in aphabetical order List<String> output = reader. lines(). flatMap(line -> Stream.of(line.split(REGEXP))). filter(word -> word.length() > 0). map(String::toLowerCase). sorted(). collect(toList());
  • 41. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.41 Annotations On Java Types  Annotations can currently only be used on type declarations – Classes, methods, variable definitions  Extension for places where types are used – e.g. parameters  Permits error detection by pluggable type checkers – e.g. null pointer errors, race conditions, etc public void process(@notnull List data) {…}
  • 42. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.42 Concurrency Updates  Scalable update variables – DoubleAccumulator, DoubleAdder, etc – Multiple variables avoid update contention – Good for frequent updates, infrequent reads  ConcurrentHashMap updates – Improved scanning support, key computation  ForkJoinPool improvements – Completion based design for IO bound applications – Thread that is blocked hands work to thread that is running
  • 43. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.43 Parallel Array Sorting  Additional utility methods in java.util.Arrays – parallelSort (multiple signatures for different primitives)  Anticipated minimum improvement of 30% over sequential sort – For dual core system with appropriate sized data set  Built on top of the fork-join framework – Uses Doug Lea’s ParallelArray implementation – Requires working space the same size as the array being sorted
  • 44. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.44 Date And Time APIs  A new date, time, and calendar API for the Java SE platform  Supports standard time concepts – Partial, duration, period, intervals – date, time, instant, and time-zone  Provides a limited set of calendar systems and be extensible to others  Uses relevant standards, including ISO-8601, CLDR, and BCP47  Based on an explicit time-scale with a connection to UTC
  • 45. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.45 Base64 Encoding and Decoding  Currently developers are forced to use non-public APIs – sun.misc.BASE64Encoder – sun.misc.BASE64Decoder  Java SE 8 now has a standard way – java.util.Base64.Encoder – java.util.Base64.Decoder – encode, encodeToString, decode, wrap methods
  • 46. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.46 Nashorn JavaScript Engine  Lightweight, high-performance JavaScript engine – Integrated into JRE  Use existing javax.script API  ECMAScript-262 Edition 5.1 language specification compliance  New command-line tool, jjs to run JavaScript  Internationalised error messages and documentation
  • 47. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.47 Removal Of The Permanent Generation  No more need to tune the size of it  Current objects moved to Java heap or native memory – Interned strings – Class metadata – Class static variables  Part of the HotSpot, JRockit convergence Permanently
  • 48. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.48 JavaFX 8 New Theme 4 Caspian vs Modena
  • 49. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.49 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Modena
  • 50. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.50 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Modena
  • 51. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.51 JavaFX 8  Customisable – Configurable key combinations to exit full screen mode – Ability to prevent user exiting full screen mode Improvements To Full Screen Mode // Set the key combination that the user can use to exit stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); // Setup the click handler so we can escape from full screen Rectangle r = new Rectangle(0, 0, 250, 250); r.setOnMouseClicked(e -> stage.setFullScreen(false)); // Set full screen again stage.setFullScreen(true);
  • 52. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.52 JavaFX 8  New API for printing – Currently only supported on desktop  Any node can be printed Printing Support PrinterJob job = PrinterJob.createPrinterJob(printer); job.getJobSettings().setPageLayout(pageLayout); job.getJobSettings().setPrintQuality(PrintQuality.HIGH); job.getJobSettings().setPaperSource(PaperSource.MANUAL); job.getJobSettings().setCollation(Collation.COLLATED); if (job.printPage(someRichText)) job.endJob();
  • 53. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.53 JavaFX 8  DatePicker  TreeTableView New Controls
  • 54. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.54 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. The JavaFX DatePicker is designed with the new Calendaring APIs in Java 8 using java.time DatePicker
  • 55. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.55 55 DatePicker
  • 56. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.56 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. DatePicker import java.time.LocalDate; // From new Date/Time API ... LocalDate ld; DatePicker dp = new DatePicker(); dp.setOnAction(e -> { ld = dp.getValue(); System.out.println("Date selected " + ld); });
  • 57. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.57 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Date Picker
  • 58. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.58 TreeTableView UI control with combined TreeView and TableView controls functionality 58
  • 59. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.59 JavaFX 8  Gestures – Swipe – Scroll – Rotate – Zoom  Touch events and touch points Touch Support
  • 60. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.60 Touch Gestures
  • 61. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.61 Handling Touch (TouchEvent/TouchPoint)  A TouchEvent contains information about a touch, including: – Event type: Pressed, released, moved, or stationary – Touch points: The TouchPoint instances that represent each of the points that were touched  Each TouchEvent has a unique ID to identify the events and touch points in a multi-touch action
  • 62. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.62 Responding to Touch Events
  • 63. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.63 JavaFX 8  Predefined shapes – Box – Cylinder – Sphere  User-defined shapes – TriangleMesh, MeshView  PhongMaterial  Lighting  Cameras 3D Support
  • 64. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.64 64 Creating Primitive Shapes and Materials
  • 65. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.65 Placing a Texture on a Sphere 65
  • 66. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.66 Placing a Texture on a Sphere 66
  • 67. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.67 3D Lights ■ Lights are nodes in the scene graph ■ PointLight ■ AmbientLight ■ Default light provided if no active lights 67
  • 68. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.68 68 Lights, Camera, Action!
  • 69. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.69 Example 3D multi-touch app: ZenGuitar3D
  • 70. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.70 Compact Profiles Approximate static footprint goals Compact1 Profile Compact2 Profile Compact3 Profile Full JRE 54Mb 30Mb 16Mb 11Mb
  • 71. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.71 Java SE Embedded  Optimised binary for embedded use from devices to gateways  Latest Java innovations in the smallest footprint  Use of compact profiles – Approximate JRE size 20.4Mb (ARM v7 VFS, Hard Float)  Compact profile 1: 10.4Mb  JavaFX: 10Mb  Production ready binary for popular platforms that run Linux – ARM v6/7 with Hard floating point – Raspberry Pi is one of the reference platforms
  • 72. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.72 Java ME 8: Building The Internet of Things
  • 73. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.73 Java ME 8 Focus Java ME EmbeddedJava Card SECURITY SMALL EMBEDDED MEDIUM EMBEDDED LARGE EMBEDDED DESKTOP SERVER 50KB-1MB 1MB-10MB 10MB-100MB Footprint Java SE Embedded Java Embedded Suite Oracle Event Processing Embedded 100MB+ Java SE ARM Cortex M3/M4 ARM Cortex-A
  • 74. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.74 Java ME 8 Platform Overview Java VM Additional APIs (Examples) Java ME Connected Limited Device Configuration (CLDC) 8 (JSR 360) Additional Optional APIs On-Device I/O Access Vertical Specific APIs Location Messaging Wireless Communication Web Services Protocols and Data Conversion Sensors Additional Optional JSRs Security and Management Use Case Software (e.g. smart pen) Use Case Software (e.g. wireless module) Use Case Software (e.g. control unit) Use Case Software (e.g. smart meter) Application Platform Java ME Embedded Profile (MEEP) 8 (JSR 361) On-Device I/O Access Device I/O API SATSA (JSR 177) Security and Trust Services Generic Connection Framework GCF 8
  • 75. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.75 Java ME 8 Key Features  Aligned with Java SE 8 – Language, libraries, VM  Designed for embedded – Fully headless operation – Remote software provisioning and management  Highly portable and scalable – Minimum RAM footprint of 1Mb  Consistent across devices
  • 76. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.76 Java ME 8 Key Features  Advanced application platform – Multi-application model  Modularised software services – Faster and more flexible software development and deployment  Multi-client domains (“partitioning”) – Different clients can have different security domains  Access to peripheral devices (Device I/O API)  Compatible with JCP/JSR standard APIs
  • 77. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.77 Connected Limited Device Configuration 8 Language Alignment with SE 8 VM Alignment with SE 8 Library Alignment with SE 8 Compact Configuration for very small devices GCF 8 to provides flexible networking Developer leverage of tools, APIs and knowledge CLDC 8 Key Features
  • 78. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.78 Generic Connection Framework 8  SecureServerConnection  SecureDatagramConnection  ModemConnection  UDPMulticastConnection  CommConnection  HttpConnection  HttpsConnection  SecureConnection  ServerSocketConnection  SocketConnection  UDPDatagramConnection Substantially Increased Range of Connection Types
  • 79. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.79 MEEP 8 Java ME Embedded Profile (MEEP) 8 Architecture CLDC 8 javax. microedition. midlet NEW UPDATED javax. microedition. io (optional) javax. microedition. event (optional) javax. microedition. key (optional) javax. microedition. lui (optional) javax. microedition. media (optional) javax. microedition. power (optional) javax. microedition. rms (optional) javax. microedition. swm (optional) javax. microedition. cellular (optional) Application or Service Application or Service Application or Service
  • 80. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.80 NetBeans 8: The IDE For Java 8
  • 81. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.81 Tools for Java SE 8  Quickly convert anonymous inner classes to lambdas Lambda Expressions
  • 82. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.82 Tools for Java SE 8  Static analysis to ensure safe transformation, automatically add cast for correct type Lambda Expressions
  • 83. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.83 Tools for Java SE 8  Editor support for functional operations over collections Internal Iterators via Java 8 Streams 1 2 3
  • 84. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.84 Tools for Java SE 8  Smoothly convert to internal iterators via hints and tips Internal Iterators via Java 8 Streams
  • 85. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.85 Tools for Java SE 8  Quickly add explicit parameter types for readability Explicit Parameter Types For Lambda Expressions
  • 86. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.86 Tools for Java SE 8  Easily convert from lambdas to method references Method References
  • 87. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.87 Tools for Java SE 8  Specify a scope for upgrading to Java 8 – All/current projects – Specific package – Specific class  Run converters  Visually preview proposals for refactoring Refactoring in Batch Mode
  • 88. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.88 Tools for Java SE Embedded 8  Full Development Cycle support against a remote platform – Intuitive development – One-click deploy – Remote debugging – Comprehensive remote profiling  Complete end to end integration for Raspberry Pi and other embedded devices, – e.g.Web Services. Seamless Integration
  • 89. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.89 Tools for Java ME Embedded 8  Java ME 8 CLDC Platform Emulator  Intuitive tools and editors for JDK 8 on Java ME  Simple customization of optional packages Seamless Integration
  • 90. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.90 Where Next?
  • 91. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.91 Java 8 Learn More & Resources
  • 92. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.92 Conclusions  Java SE 8 adds powerful new features to the core – Lambda expressions, streams and functions – New controls, stylesheet and 3D support in JavaFX  Java ME 8 focused on embedded development – Device I/O APIs  NetBeans 8, ready for Java 8 development – Lambda support, embedded support  Java continues to evolve
  • 93. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.93 Java 9 And Beyond  Modularisation of the Java platform – Project Jigsaw  Foreign function interface – Like JNI  Enhanced volatiles Java Never Stops
  • 94. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.94
  • 95. Copyright © 2014, Oracle and/or its affiliates. All rights reserved.95