SlideShare a Scribd company logo
1 of 25
Welcome to Java 9
Spring Days – 6/20/17
Jeanne Boyarsky
https://www.slideshare.net/
boyarsky/2017-java9springdays
Twitter @jeanneboyarsky
Blog: http://www.selikoff.net
Modules (Jigsaw)
Problem
• Jar hell
• Solution – Maven/Gradle?
• No closed/private packages
Java 9
• Modules!
Twitter: @jeanneboyarsky
Jigsaw – flux
• You can use a command line flag.
• The flag might or might not be the default.
Twitter: @jeanneboyarsky
Do you
•use sun.* internal APIs?
•use a jar that does?
• 2011 – Maybe part of Java 7. Nope Plan B
• 2012 - Part of Java 8. No wait
• 2014 - Part of Java 9
• Sept 2016
• May 2017
• July 2017
• Sept 2017?
The Saga of Jigsaw
Twitter: @jeanneboyarsky
Moving on
That was nerve wracking.
We clearly need sugar!
Twitter: @jeanneboyarsky
Creating a non-empty Set
Set<String> set = new HashSet<>(
Arrays.asList("1","2", "3"));
Set<String> set = Stream.of("1", "2”, "3")
.collect(Collectors.toSet());
Set<String> set = Set.of("1", "2", "3");
Twitter: @jeanneboyarsky
For consistency
Map<String, String> map = Map.of("k", "v");
Up to 10 params, then varargs
List<String> list = List.of("1", "2", "3");
Up to 20 params, then varargs
Twitter: @jeanneboyarsky
Better Map
Twitter: @jeanneboyarsky
Map<Integer, Integer> map =
Map.ofEntries(
Map.entry(1, 10),
Map.entry(2, 20)
);
JavaDoc Search Upgrade
Twitter: @jeanneboyarsky
(to 2017)
Try with Resources
Path path = Paths.get("test.txt");
try (BufferedReader reader =
Files.newBufferedReader(path)) {
System.out.println(reader.readLine());
}
Effectively final
resources
Twitter: @jeanneboyarsky
BufferedReader reader =
Files.newBufferedReader(path);
try (reader) {
System.out.println(reader.readLine());
}
What’s wrong here?
Connection con =
DriverManager.getConnection(url);
PreparedStatement ps =
con.prepareStatement(sql);
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
try (con; ps; rs) {
while (rs.next()) {
// process result set
} } Twitter: @jeanneboyarsky
Resource leak!
@Deprecated
“Very few deprecated APIs were actually
removed, leading some people to believe that
nothing would ever be removed.
On the other hand, other people believed that
everything that was deprecated might
eventually be removed, which was never the
intent either.”
From JEP 277
Twitter: @jeanneboyarsky
@Deprecated New Attributes
Attribute Type Description
forRemoval boolean Is the intent to remove API
from Java at some point?
since String Version of Java when API
first became deprecated (not
populated for all pre-Java 9
APIs)
Twitter: @jeanneboyarsky
Only had for new
APIs before
Twitter: @jeanneboyarsky
@Deprecated
Warning types
• Ordinary Deprecation
• Removal
@SuppressWarnings("deprecation”)
@SuppressWarnings("removal”)
@SuppressWarnings({"deprecation", "removal"})
Twitter: @jeanneboyarsky
What is deprecated for removal?
• Unused code in AWT
• Some old security APIs
• Some thread and runtime APIs
• Some Jigsaw transition modules
(but not classes)
• And…
Twitter: @jeanneboyarsky
Applets
Finally deprecated!
But…
forRemoval=false
Applet
Twitter: @jeanneboyarsky
Streams - takeWhile
Stream.iterate(entry(1,1),
e -> entry(e.getValue(),
e.getKey()+e.getValue()))
.map(Entry::getValue)
.takeWhile(n -> n < 30)
.forEach(System.out::println);
How print all Fibonacci #s less than 30?
Assumes ordered stream. Takes all elements until
one doesn’t match.
Twitter: @jeanneboyarsky
Streams - dropWhile
Stream.iterate(entry(1,1),
e -> entry(e.getValue(),
e.getKey()+e.getValue()))
.map(Entry::getValue)
.dropWhile(n -> n < 30)
.forEach(System.out::println);
How print all Fibonacci #s greater than 30?
Note: This doesn’t work. takeWhile and dropWhile
aren’t always opposites. See why?
Twitter: @jeanneboyarsky
Streams - iterate
Stream.iterate(10, i-> i-1)
.limit(10)
.forEach(System.out::println);
Stream.iterate(10, i-> i>0, i-> i-1)
.forEach(System.out::println);
Twitter: @jeanneboyarsky
Streams - ofNullable
stream = dubiousObj == null
? Stream.empty()
: Stream.of(dubiousObj);
stream = Stream.ofNullable(dubiousObj);
Twitter: @jeanneboyarsky
JShell
• REPL for Java
• Now with tab and up arrow
• More packages known than Nashorn
Twitter: @jeanneboyarsky
Random other changes
• Can now have private methods in interfaces
• _ is no longer a legal identifier. Still ok to have
vars like _temp
• sun.misc.Unsafe was replaced by VarHandle. I
can’t imagine needing to do either. Maybe for
low level APIs
• Could use @SafeVarargs on static methods or
final instance methods. Now can do the same
for private instance methods
Twitter: @jeanneboyarsky
More new APIs
APIs for reactive programming:
•Flow.Processor
•Flow.Publisher
•Flow.Subscriber
•Flow.Subscription
(new class Flow)
Process APIs
Process.pid()
supportsNormalTermination()
CompletableFuture<Process> onExit()
info()
descendants()
children()
Twitter: @jeanneboyarsky
Questions
?
Twitter: @jeanneboyarsky

More Related Content

What's hot

What's hot (18)

Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
 
What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017What's New in JHipsterLand - DevNexus 2017
What's New in JHipsterLand - DevNexus 2017
 
Testing Angular Applications - Jfokus 2017
Testing Angular Applications - Jfokus 2017Testing Angular Applications - Jfokus 2017
Testing Angular Applications - Jfokus 2017
 
Herding a Cat with Antlers - Catalyst 5.80
Herding a Cat with Antlers - Catalyst 5.80Herding a Cat with Antlers - Catalyst 5.80
Herding a Cat with Antlers - Catalyst 5.80
 
Testing Mobile JavaScript
Testing Mobile JavaScriptTesting Mobile JavaScript
Testing Mobile JavaScript
 
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016Get Hip with JHipster - Colorado Springs OSS Meetup April 2016
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
Web Frameworks of the Future: Flex, GWT, Grails and Rails
Web Frameworks of the Future: Flex, GWT, Grails and RailsWeb Frameworks of the Future: Flex, GWT, Grails and Rails
Web Frameworks of the Future: Flex, GWT, Grails and Rails
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx 2015
 
Software Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill SparksSoftware Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill Sparks
 
Async await...oh wait!
Async await...oh wait!Async await...oh wait!
Async await...oh wait!
 
Realtime Apps with Django
Realtime Apps with DjangoRealtime Apps with Django
Realtime Apps with Django
 
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
 
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love itDrupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
Drupal 8: Huge wins, a Bigger Community, and why you (and I) will Love it
 
What's New in JHipsterLand - Devoxx US 2017
What's New in JHipsterLand - Devoxx US 2017What's New in JHipsterLand - Devoxx US 2017
What's New in JHipsterLand - Devoxx US 2017
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$
 
On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)On Selecting JavaScript Frameworks (Women Who Code 10/15)
On Selecting JavaScript Frameworks (Women Who Code 10/15)
 
Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016Testing Angular 2 Applications - Rich Web 2016
Testing Angular 2 Applications - Rich Web 2016
 

Similar to 2017 java9-spring-days

Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallery
njbartlett
 

Similar to 2017 java9-spring-days (20)

Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
Java to Scala: Why & How
Java to Scala: Why & HowJava to Scala: Why & How
Java to Scala: Why & How
 
JRuby 6 Years in Production
JRuby 6 Years in ProductionJRuby 6 Years in Production
JRuby 6 Years in Production
 
Monkeybars in the Manor
Monkeybars in the ManorMonkeybars in the Manor
Monkeybars in the Manor
 
Java 9 Functionality and Tooling
Java 9 Functionality and ToolingJava 9 Functionality and Tooling
Java 9 Functionality and Tooling
 
Hacking Java @JavaLand2016
Hacking Java @JavaLand2016Hacking Java @JavaLand2016
Hacking Java @JavaLand2016
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallery
 
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning TalksBuilding Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
 
Real World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarReal World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains Webinar
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)Making The Move To Java 17 (JConf 2022)
Making The Move To Java 17 (JConf 2022)
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Preparing for java 9 modules upload
Preparing for java 9 modules uploadPreparing for java 9 modules upload
Preparing for java 9 modules upload
 
Just enough app server
Just enough app serverJust enough app server
Just enough app server
 
Better Career with Java
Better Career with JavaBetter Career with Java
Better Career with Java
 
Java days Lviv 2015
Java days Lviv 2015Java days Lviv 2015
Java days Lviv 2015
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 

More from Jeanne Boyarsky

More from Jeanne Boyarsky (20)

Pathways intro january 2018
Pathways intro   january 2018Pathways intro   january 2018
Pathways intro january 2018
 
Pathways path-comparison
Pathways path-comparisonPathways path-comparison
Pathways path-comparison
 
2017 stuysplash-build-tools
2017 stuysplash-build-tools2017 stuysplash-build-tools
2017 stuysplash-build-tools
 
Virtual scrum
Virtual scrumVirtual scrum
Virtual scrum
 
Ignite java-robots
Ignite java-robotsIgnite java-robots
Ignite java-robots
 
2017 JavaOne Mutation Testing Session
2017 JavaOne Mutation Testing Session2017 JavaOne Mutation Testing Session
2017 JavaOne Mutation Testing Session
 
java 8 Hands on Workshop
java 8 Hands on Workshopjava 8 Hands on Workshop
java 8 Hands on Workshop
 
Pathways overview
Pathways overviewPathways overview
Pathways overview
 
2016 java-sig-mutation-testing
2016 java-sig-mutation-testing2016 java-sig-mutation-testing
2016 java-sig-mutation-testing
 
Ftc judging
Ftc judgingFtc judging
Ftc judging
 
2016 qcon-virtual-scrum
2016 qcon-virtual-scrum2016 qcon-virtual-scrum
2016 qcon-virtual-scrum
 
2016 java9-how-make-qus
2016 java9-how-make-qus2016 java9-how-make-qus
2016 java9-how-make-qus
 
2016 java9-how-make-qus
2016 java9-how-make-qus2016 java9-how-make-qus
2016 java9-how-make-qus
 
2016 first-champs-java-cert
2016 first-champs-java-cert2016 first-champs-java-cert
2016 first-champs-java-cert
 
2016 java8-cert-intro
2016 java8-cert-intro2016 java8-cert-intro
2016 java8-cert-intro
 
FTC 2015-2016 Judging
FTC 2015-2016 JudgingFTC 2015-2016 Judging
FTC 2015-2016 Judging
 
2015 nyc-spin-collective-ownership
2015 nyc-spin-collective-ownership2015 nyc-spin-collective-ownership
2015 nyc-spin-collective-ownership
 
FTC Robot C to Java
FTC Robot C to JavaFTC Robot C to Java
FTC Robot C to Java
 
Frc java5-8andeclipse
Frc java5-8andeclipseFrc java5-8andeclipse
Frc java5-8andeclipse
 
Throw Away all the Rules: Now What Process do you Follow?
Throw Away all the Rules: Now What Process do you Follow?Throw Away all the Rules: Now What Process do you Follow?
Throw Away all the Rules: Now What Process do you Follow?
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

2017 java9-spring-days

  • 1. Welcome to Java 9 Spring Days – 6/20/17 Jeanne Boyarsky https://www.slideshare.net/ boyarsky/2017-java9springdays Twitter @jeanneboyarsky Blog: http://www.selikoff.net
  • 2. Modules (Jigsaw) Problem • Jar hell • Solution – Maven/Gradle? • No closed/private packages Java 9 • Modules! Twitter: @jeanneboyarsky
  • 3. Jigsaw – flux • You can use a command line flag. • The flag might or might not be the default. Twitter: @jeanneboyarsky Do you •use sun.* internal APIs? •use a jar that does?
  • 4. • 2011 – Maybe part of Java 7. Nope Plan B • 2012 - Part of Java 8. No wait • 2014 - Part of Java 9 • Sept 2016 • May 2017 • July 2017 • Sept 2017? The Saga of Jigsaw Twitter: @jeanneboyarsky
  • 5. Moving on That was nerve wracking. We clearly need sugar! Twitter: @jeanneboyarsky
  • 6. Creating a non-empty Set Set<String> set = new HashSet<>( Arrays.asList("1","2", "3")); Set<String> set = Stream.of("1", "2”, "3") .collect(Collectors.toSet()); Set<String> set = Set.of("1", "2", "3"); Twitter: @jeanneboyarsky
  • 7. For consistency Map<String, String> map = Map.of("k", "v"); Up to 10 params, then varargs List<String> list = List.of("1", "2", "3"); Up to 20 params, then varargs Twitter: @jeanneboyarsky
  • 8. Better Map Twitter: @jeanneboyarsky Map<Integer, Integer> map = Map.ofEntries( Map.entry(1, 10), Map.entry(2, 20) );
  • 9. JavaDoc Search Upgrade Twitter: @jeanneboyarsky (to 2017)
  • 10. Try with Resources Path path = Paths.get("test.txt"); try (BufferedReader reader = Files.newBufferedReader(path)) { System.out.println(reader.readLine()); } Effectively final resources Twitter: @jeanneboyarsky BufferedReader reader = Files.newBufferedReader(path); try (reader) { System.out.println(reader.readLine()); }
  • 11. What’s wrong here? Connection con = DriverManager.getConnection(url); PreparedStatement ps = con.prepareStatement(sql); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); try (con; ps; rs) { while (rs.next()) { // process result set } } Twitter: @jeanneboyarsky Resource leak!
  • 12. @Deprecated “Very few deprecated APIs were actually removed, leading some people to believe that nothing would ever be removed. On the other hand, other people believed that everything that was deprecated might eventually be removed, which was never the intent either.” From JEP 277 Twitter: @jeanneboyarsky
  • 13. @Deprecated New Attributes Attribute Type Description forRemoval boolean Is the intent to remove API from Java at some point? since String Version of Java when API first became deprecated (not populated for all pre-Java 9 APIs) Twitter: @jeanneboyarsky Only had for new APIs before
  • 15. @Deprecated Warning types • Ordinary Deprecation • Removal @SuppressWarnings("deprecation”) @SuppressWarnings("removal”) @SuppressWarnings({"deprecation", "removal"}) Twitter: @jeanneboyarsky
  • 16. What is deprecated for removal? • Unused code in AWT • Some old security APIs • Some thread and runtime APIs • Some Jigsaw transition modules (but not classes) • And… Twitter: @jeanneboyarsky
  • 18. Streams - takeWhile Stream.iterate(entry(1,1), e -> entry(e.getValue(), e.getKey()+e.getValue())) .map(Entry::getValue) .takeWhile(n -> n < 30) .forEach(System.out::println); How print all Fibonacci #s less than 30? Assumes ordered stream. Takes all elements until one doesn’t match. Twitter: @jeanneboyarsky
  • 19. Streams - dropWhile Stream.iterate(entry(1,1), e -> entry(e.getValue(), e.getKey()+e.getValue())) .map(Entry::getValue) .dropWhile(n -> n < 30) .forEach(System.out::println); How print all Fibonacci #s greater than 30? Note: This doesn’t work. takeWhile and dropWhile aren’t always opposites. See why? Twitter: @jeanneboyarsky
  • 20. Streams - iterate Stream.iterate(10, i-> i-1) .limit(10) .forEach(System.out::println); Stream.iterate(10, i-> i>0, i-> i-1) .forEach(System.out::println); Twitter: @jeanneboyarsky
  • 21. Streams - ofNullable stream = dubiousObj == null ? Stream.empty() : Stream.of(dubiousObj); stream = Stream.ofNullable(dubiousObj); Twitter: @jeanneboyarsky
  • 22. JShell • REPL for Java • Now with tab and up arrow • More packages known than Nashorn Twitter: @jeanneboyarsky
  • 23. Random other changes • Can now have private methods in interfaces • _ is no longer a legal identifier. Still ok to have vars like _temp • sun.misc.Unsafe was replaced by VarHandle. I can’t imagine needing to do either. Maybe for low level APIs • Could use @SafeVarargs on static methods or final instance methods. Now can do the same for private instance methods Twitter: @jeanneboyarsky
  • 24. More new APIs APIs for reactive programming: •Flow.Processor •Flow.Publisher •Flow.Subscriber •Flow.Subscription (new class Flow) Process APIs Process.pid() supportsNormalTermination() CompletableFuture<Process> onExit() info() descendants() children() Twitter: @jeanneboyarsky

Editor's Notes

  1. https://pixabay.com/p-313586/?no_redirect
  2. https://en.wikipedia.org/wiki/Java_Platform_Module_System
  3. https://pixabay.com/p-485050/?no_redirect
  4. http://openjdk.java.net/jeps/269 https://pixabay.com/p-485050/?no_redirect
  5. http://openjdk.java.net/jeps/269 https://pixabay.com/p-485050/?no_redirect
  6. http://openjdk.java.net/jeps/269 https://pixabay.com/p-485050/?no_redirect https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Map_of_USA_with_state_names.svg/2000px-Map_of_USA_with_state_names.svg.png
  7. http://openjdk.java.net/jeps/225 https://c1.staticflickr.com/3/2588/3781549100_6e6fbcd184_b.jpg
  8. http://openjdk.java.net/jeps/225
  9. http://openjdk.java.net/jeps/225
  10. http://openjdk.java.net/jeps/277
  11. http://openjdk.java.net/jeps/277
  12. http://openjdk.java.net/jeps/277
  13. http://openjdk.java.net/jeps/277
  14. http://download.java.net/java/jdk9/docs/api/deprecated-list.html https://pixabay.com/p-1111448/?no_redirect
  15. http://openjdk.java.net/jeps/289 https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Argentina_-_NO_symbol.svg/2000px-Argentina_-_NO_symbol.svg.png
  16. http://openjdk.java.net/jeps/222 http://openjdk.java.net/jeps/236 http://openjdk.java.net/jeps/292 https://www.selikoff.net/2017/05/13/using-java-9s-jshell-for-experimenting/
  17. http://openjdk.java.net/jeps/213
  18. http://openjdk.java.net/jeps/266