Those are the slides for my presentation at OracleCode One 2018.
Java is moving faster and faster. A lot of features are not as known as they should be.
Let's review together the ones I think you've missed in old versions.
Then I will kickstart you on 9, 10 and 11 features that you never had time to look at.
1. Basic Java class
class Ex1
{
public static void main(String args[])
{
int width;
int length;
int height;
width=5;
length=12;
height=3;
int v;
v=width*length*height;
System.out.println("Volume is :"+v);
}
}
Volume is :180
This presentation is on advanced debugging using Java bytecodes (presented in Core Java meetup on 1st October in Accion Labs). If you are a Java developer and are interested in knowing advanced debugging techniques or understanding bytecodes, this presentation is for you.
This presentation provides an overview of key topics in Java class design; also covers best practices/tips and quiz questions. Based on our OCP 8 book.
1. Basic Java class
class Ex1
{
public static void main(String args[])
{
int width;
int length;
int height;
width=5;
length=12;
height=3;
int v;
v=width*length*height;
System.out.println("Volume is :"+v);
}
}
Volume is :180
This presentation is on advanced debugging using Java bytecodes (presented in Core Java meetup on 1st October in Accion Labs). If you are a Java developer and are interested in knowing advanced debugging techniques or understanding bytecodes, this presentation is for you.
This presentation provides an overview of key topics in Java class design; also covers best practices/tips and quiz questions. Based on our OCP 8 book.
Java is moving faster and faster. A lot of features are not as known as they should be.
Let’s review together the old ones you missed.
Then show you the ones you never had time to look at in 9, 10, 11, 12 and 13.
And go crazy to check how it’s implemented under the hood (yes, there will be bytecode).
Example of using Kotlin lang features for writing DSL for Spark-Cassandra connector. Comparison Kotlin lang DSL features with similar features in others JVM languages (Scala, Groovy).
This webinar by Oleksandr Navka (Lead Software Engineer, Consultant, GlobalLogic) was delivered at Java Community Webinar #1 on August 12, 2020.
Webinar agenda:
- The new structural unit of the program is Java Records
- Updated instanceof statement
- Updated switch operator
More details and presentation: https://www.globallogic.com/ua/about/events/java-community-webinar-1/
Gadsu is a home made software to aid a Shiatsu practitioner in managing clients, appointments and medical data in combination with an expert system providing TCM inferred diagnosis.
It's written in Kotlin, using good old Swing.
The Kotlin 101 presentation was the very first presentation of the Kotlin Usergroup Vienna (https://www.meetup.com/Kotlin-Vienna/), held at a meeting from the Java Student Usergroup in 2016 (https://www.meetup.com/Java-Vienna/). It explains the raw (syntactical) fundamentals of the language targeting a Java developer audience.
An overview of the inner-workings of OpenJDK - with emphasis on...
- what triggers the just-in-time compiler (JIT)
- types of speculative optimizations performed by the JIT
- aspects of the Java language & ecosystem that make ahead-of-time (AOT) compilation challenging
Why is Java relevant? New features of Java8 xshyamx
Presentation slides from ISDC2013 held on 16-mar-2013
http://www.siliconindia.com/events-overview/India--Software-Developer-Conference-Bangalore-ISDC_2013Blr.html
Java is moving faster and faster. A lot of features are not as known as they should be.
Let’s review together the old ones you missed.
Then show you the ones you never had time to look at in 9, 10, 11, 12 and 13.
And go crazy to check how it’s implemented under the hood (yes, there will be bytecode).
Example of using Kotlin lang features for writing DSL for Spark-Cassandra connector. Comparison Kotlin lang DSL features with similar features in others JVM languages (Scala, Groovy).
This webinar by Oleksandr Navka (Lead Software Engineer, Consultant, GlobalLogic) was delivered at Java Community Webinar #1 on August 12, 2020.
Webinar agenda:
- The new structural unit of the program is Java Records
- Updated instanceof statement
- Updated switch operator
More details and presentation: https://www.globallogic.com/ua/about/events/java-community-webinar-1/
Gadsu is a home made software to aid a Shiatsu practitioner in managing clients, appointments and medical data in combination with an expert system providing TCM inferred diagnosis.
It's written in Kotlin, using good old Swing.
The Kotlin 101 presentation was the very first presentation of the Kotlin Usergroup Vienna (https://www.meetup.com/Kotlin-Vienna/), held at a meeting from the Java Student Usergroup in 2016 (https://www.meetup.com/Java-Vienna/). It explains the raw (syntactical) fundamentals of the language targeting a Java developer audience.
An overview of the inner-workings of OpenJDK - with emphasis on...
- what triggers the just-in-time compiler (JIT)
- types of speculative optimizations performed by the JIT
- aspects of the Java language & ecosystem that make ahead-of-time (AOT) compilation challenging
Why is Java relevant? New features of Java8 xshyamx
Presentation slides from ISDC2013 held on 16-mar-2013
http://www.siliconindia.com/events-overview/India--Software-Developer-Conference-Bangalore-ISDC_2013Blr.html
Finally Java SE 7 is GA and you can start using it. This talk will cover the most important new features of the language and the virtual machine. It will also cover some features that did not make it in to the SE 7 release. Finally we will discuss current state of Java as an ecosystem and my analysis and hopes for the future.
Rapid application development techniques, favoring rapid prototyping over intensive planning, have become popular in the last few years. Although the "old-school" Java Web frameworks (such as Struts and JSF) are well suited for enterprise projects, their development cycle is often too slow and complicated for prototyping. Due to their nature, dynamic languages such as Ruby, Python, and Groovy are natural for fast prototyping and scaffolding. But is there a way to benefit the Java ecosystem without compromising simplicity and productivity? This presentation tries to answer this question by comparing, head-to-head, three leading Java RAD tools—SeamForge, Play, and Roo—by writing a full-blown Web application in each of them, comparing the pros and cons along the way.
Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembler helps the C or C++ programmer. Java bytecode is the form of instructions that Java virtual machine executes. This knowledge is crucial when debugging and doing performance and memory usage tuning. The presenter will share his knowledge on what bytecode means for your platform and how to create compiler while using some awesome tools.
JavaOne 2016 - Learn Lambda and functional programmingHenri Tremblay
This tutorial walks through tons of examples. You will learn everything you need to know about lambdas and functional programming in Java 8. I'm the supplier. You’re the consumer (and you will get the joke after the session).
While most bugs reveal their cause within their stack trace, Java’s OutOfMemoryError is less talkative and therefore regarded as being difficult to debug by a majority of developers. With the right techniques and tools, memory leaks in Java programs can however be tackled like any other programming error. This talks discusses how a JVM stores data, categorizes different types of memory leaks that can occur in a Java program and presents techniques for fixing such errors. Furthermore, we will have a closer look at lambda expressions and their considerable potential of introducing memory leaks when they are used incautiously.
A look at the future of JVM languages including Kotlin, Scala, Groovy, and latest Java.
Which language to use ? what are the benefits of higher level abstractions ? and what are the benefits of programming on the JVM ?
Être pragmatique en développement logiciel est plus rare que l'on pourrait penser. J'ai vu toutes sortes d'aberrations à travers les années. Des architectes, des analystes, des développeurs faisant et croyant des choses qui ne font simplement aucun sens dans aucune dimension.
À partir d'exemples tirés de mon expérience, je vais vous enseigner quelques trucs pour être vraiment pragmatique. Ceci va vous permettre d'avoir les bons réflexes face à une décision. Pour rapidement développer des logiciels que les gens veulent utiliser. Que vous soyez gestionnaire ou développeur, vous devriez y trouver votre compte.
DevNexus 2018: Learn Java 8, lambdas and functional programmingHenri Tremblay
This session walks through tons of examples in live coding. You will learn everything you need to know about lambdas and functional programming in Java 8. I’m the supplier. You’re the consumer (and you will get the joke after the session).
Do you know your mock? - Madras JUG 20171028Henri Tremblay
An important pillar of unit tests is the Mock Object, also known as Test Doubles. They come in many types and flavours. Together, we will name them and demonstrate them using EasyMock and Mockito.
Source code: https://github.com/henri-tremblay/mocks
Be pragmatic in software development is rarer than one would expect or hope. I've seen all sorts of craziness throughout the years. Architects, analysts and developers doing and believing things that simply made no sense in any worlds.
Using examples from my experience, I will teach you tricks to really be pragmatic. This will allow you to quickly develop software that people really want to use. Whether you are a manager or a developer, you should find it useful.
Java 8, lambdas, generics: How to survive? - NYC Java Meetup GroupHenri Tremblay
Lambdas are sexy. But they are adding complexity. Mixed with generics, it creates a dangerous cocktail. Together, we will start from the bottom of generics and go straight through lambda inference. To explain why it is the way it is and tell you how to survive.
Generics and Lambdas cocktail explained - Montreal JUGHenri Tremblay
We are in 2015 and Java 8 will slowly but surely become the new standard. Our world will be filled with lambdas. Generics, for themselves, have appeared in 2004. They brought benefits and complexity. Enough to blow up the complexity quota of Java according to Josh Bloch.
But lambdas, whatever are sexy they are, are going to add even more complexity. Mix with generics your now playing with nitroglycerin.
We will travel together through the bottom of the generics, through inference and through lambdas type resolution. To explain why. To provide solutions. To ease Java 8 adoption.
My conference at USI 2014 (http://www.usievents.com/en). Explaining how we arrive to reactive programming, why we should care and what to do about it.
In French
Microbenchmark basic and lesson about being suspicious about benchmark. The source code is here: https://github.com/henri-tremblay/microbenchmarkingwithjmh
Lambdas and Generics (long version) - Bordeaux/Toulouse JUGHenri Tremblay
Lambda expressions are coming soon. They promise to be a nice complexity cocktail with the 9 years old generics.
Lets go deep into the generics to get a better understanding. Mix them with lambdas and wait calmly for Java 8 to arrive.
La programmation parallèle est désormais une incontournable solution aux problèmes de performance. Ce n'est pas la seule, mais elle ne peut être ignorée. Les nombreux coeurs et CPUs qui peuplent nos serveurs en sont la preuve.
Elle peut aussi s'utiliser plus souvent qu'on pourrait le penser. Que ce soit pour diminuer les temps de réponse ou augmenter le débit.
Nous vous proposons un état des lieux. Quels sont les usages? Quel est le degré de facilité? Comment se prémunir de la complexité? CPU ou GPU?
À l'aide d'exemples de code, tout ce qui est nécessaire de mettre dans le cartable du développeur vivant dans l'air du temps.
DevoxxFR 2013: Lambda are coming. Meanwhile, are you sure we've mastered the ...Henri Tremblay
Lambda expressions are coming soon. They promise to be a nice complexity cocktail with the 9 years old generics. So, before confronting the lambdas, are you sure you're mastered the generics?
This quick talk will give you some tips to learn to swim before the flood.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
16. 16
TL;DR
OracleJDK: Free and supported to 6 months
LTS versions have extended ($$$) support by Oracle
Identical to OpenJDK when free
OpenJDK: Free forever, not supported after 6 months
Built by https://adoptopenjdk.net/
Other JVMs (Azul, IBM, RedHat, etc.)
Supported by their vendor as they wish
A lot of “May” and “Possibly” in the party line
https://medium.com/@javachampions/java-is-still-free-
c02aef8c9e04
17. 17
Funny fact
Java 9 è Java 17.9
Java 10 è Java 18.3
Java 11 è Java 18.9
java version "11-ea" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11-ea+26)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11-ea+26, mixed mode)
20. 20
/**
* Counts the number of stack frames in this thread. The thread must
* be suspended.
*
* @return the number of stack frames in this thread.
* @throws IllegalThreadStateException if this thread is not
* suspended.
* @deprecated The definition of this call depends on {@link #suspend},
* which is deprecated. Further, the results of this call
* were never well-defined.
* This method is subject to removal in a future version of Java SE.
* @see StackWalker
*/
@Deprecated(since="1.2", forRemoval=true)
public native int countStackFrames();
27. 27
JAVA 5 GAVE THE GENERIC
TYPES TO THE WORLD
(and also annotations, concurrent collections, enum types, for
each, static imports and so on and so on)
38. 38
Auto Closeable
Before
InputStream in = new FileInputStream("allo.txt");
try {
// … do stuff
} finally {
try { in.close(); } catch(IOException e) {}
}
After
try(InputStream in = new FileInputStream("allo.txt")) {
// … do stuff
}
39. 39
Auto Closeable
Real code you should do
InputStream in = new FileInputStream("allo.txt");
try {
// … do stuff
in.close();
} catch(IOException e) {
try {
in.close();
} catch(IOException e1) {
e.addSuppressed(e1);
}
throw e;
}
42. 42
JAVA 8: LAMBDA!
(and also a new date API, default methods, metaspace, Nashorn,
JavaFX and CompletableFuture)
43. 43
Base64 ;-)
import java.nio.charset.StandardCharsets;
import java.util.Base64;
public class Base64s {
public static void main(String[] args) {
final String text = "Base64 finally in Java 8!";
final String encoded = Base64
.getEncoder()
.encodeToString( text.getBytes( StandardCharsets.UTF_8 ) );
System.out.println( encoded );
final String decoded = new String(
Base64.getDecoder().decode( encoded ),
StandardCharsets.UTF_8 );
System.out.println( decoded );
}
}
44. 44
Date / Time API
Core ideas:
Immutable
A time is a time, a date is a date. Not always both (like java.util.Date)
Not everyone uses the same calendar (the same Chronology)
LocalDate, LocalTime, LocalDateTime à Local. No time zone
OffsetDateTime, OffsetTime à Time with an offset from
Greenwich
ZonedDateTime à LocalDateTime with a time zone
Duration, Period à Time span
Instant à Timestamp
Formatting à Easy and thread-safe formatting
45. 45
Date / Time API (example)
LocalDateTime now = LocalDateTime.now();
String thatSpecialDay = now
.withDayOfMonth(1)
.atZone(ZoneId.of("Europe/Paris"))
.plus(Duration.ofDays(5))
.format(DateTimeFormatter.ISO_ZONED_DATE_TIME);
System.out.println(thatSpecialDay);
Output
2016-09-06T17:45:22.488+01:00[Europe/Paris]
47. 47
(also written as λ-calculus) is a formal system in
mathematical logic for expressing computation based
on function abstraction and application using variable
binding and substitution. It is a universal model of
computation that can be used to simulate any single-
taped Turing machine and was first introduced by
mathematician Alonzo Church in the 1930s as part of an
investigation into the foundations of mathematics.
Lambda calculus
48. 48
This is a function:
This is a lambda:
Lambda calculus
51. 51
Implicit final
List<String> list = new ArrayList<>();
String greeting = "Hello "; // no final required
list.forEach(s -> System.out.println(greeting + s));
list.forEach(new Consumer<String>() {
@Override public void accept(String s) {
System.out.println(greeting + s);
}
});
list.forEach(s -> greeting = “Hi”); // won’t compile
52. 52
Interface default methods
public interface List<E> extends
Collection<E> {
default void replaceAll(UnaryOperator<E>
operator) {
// …
}
}
public interface A {
default void foo() { }
}
public interface B{
default void foo() { }
}
public class C implements A, B {} // forbidden
public class C implements A, B { // allowed
public void foo() { }
}
public static class D implements A, B { //
allowed
public void foo() {
A.super.foo();
}
}
54. 54
Mustache vol. 2
Map<Long, Person> persons = Map.of(
1L, new Person(12, "Marc"),
2L, new Person(58, "Pierre”)
);
persons.entrySet().stream()
.map(entry -> new Object() {
long id = entry.getKey();
String name = entry.getValue().getName();
})
.forEach(tuple -> {
System.out.println(tuple.id + ": " + tuple.name);
});
}
55. 55
Everything is a lambda
public interface MyInterface {
int foo();
}
public void bar(MyInterface i) {
System.out.println(i.foo());
}
bar(() -> 4);
bar(new MyInterface() {
@Override public int foo() {
return 4;
}
});
JButton btn = new JButton();
btn.addActionListener(e -> {});
But it’s better to flag them
with
@FunctionalInterface
56. 56
Method references
public static class Passenger {
public void inboard(Train train) {
System.out.println("Inboard " + train);
}
}
public static class Train {
public static Train create(Supplier< Train > supplier)
{
return supplier.get();
}
public static void paintBlue(Train train) {
System.out.println("Painted blue " + train);
}
public void repair() {
System.out.println( "Repaired " + this);
}
}
Train train = Train.create(Train::new); // constructor
List<Train> trains = Arrays.asList(train);
trains.forEach(Train::paintBlue); // static
method
trains.forEach(Train::repair); // instance
method
Passenger p = new Passenger();
trains.forEach(p::inboard); // instance
method taking this in param
trains.forEach(System.out::println); // useful!
57. 57
Upside Down
public class MethodTest {
public class Foo {
static final String ERR_MESSAGE = "bad";
public void doIt() throws IllegalStateException {
throw new IllegalStateException(ERR_MESSAGE);
}
}
@Test
public void test() {
Foo foo = new Foo();
Throwable t = captureThrowable(foo::doIt);
assertThat(t)
.isInstanceOf(IllegalStateException.class)
.hasMessage(Foo.ERR_MESSAGE);
}
public static Throwable captureThrowable(Runnable r) {
Throwable result = null;
59. 59
Functional programming
List<String> list = new ArrayList<>();
int sum= list
.stream()
.filter(s -> s.startsWith("a"))
.mapToInt(String::length)
.sum();
List<Integer> length = list
.stream()
.map(String::length)
.collect(Collectors.toList());
60. 60
Parallel
List<String> list = new ArrayList<>();
int sum = list
.parallelStream()
.filter(s -> s.startsWith("a"))
.mapToInt(String::length)
.sum();
Arrays.parallelSort(array);
69. 69
JAVA 11: CLEANUP
(and dynamic class-file constants, epsilon, java.xml, corba and
many J2EE modules removed, nashorn removed, ZGC, single file
program)
70. 70
Prepare to do some stretching
Java 8 Java 9 Java 10 Java 11
What any sane person will want his/her framework to support
71. 71
Prepare to do some stretching
Java 8 Java 9 Java 10 Java 11
What any sane person will want his/her framework to support
Unsafe.defineClass()
MethodHandles.defineClass()
Unsafe.defineClass()
removed
72. 72
Prepare to do some stretching
Java 8 Java 9 Java 10 Java 11
What any sane person will want his/her framework to support
import java.xml.bind
--add-modules javax.xml.bind
--module-path containing
jaxb-api-2.4.0-xxx.jar