Kurs om
Modern Java, version 8/9/...

Kurs om de viktigaste nyheterna i Java sedan version 8 fram till nu

Java version 8, införde tre begrepp som i grunden förändrar ditt sätt att designa programkoden inuti metoderna/funktionerna av en klass. Dessa tre är Lambda Expressions, Data Stream Pipelines samt Asynchronous Computation.

Java version 9, förändrade vårt sätt att designa Java applikationer, eftersom det nya modulsystemet (JPMS) är så pass genomgripande och skapar möjligheter för snabb uppstart av en Java applikationer och eliminering av class-not-found problem.

Java version 16, införde bland annat records, som är en förenklad form av klasser och är tänkt för data-värden och andra sammanhang där man vill ha immutable classes.

Denna kurs vänder sig till dig som idag arbetar med en tidigare version av Java och önskar att snabbt komma igång med att tillämpa alla nyheter i språket och standardbiblioteket.

Snabbfakta

Namn
Modern Java, version 8/9/...
Längd
3 dagar
Nivå
Intermediate
Målgrupp
Java programmerare
Förkunskaper
Rutinerad i Java programmering
Programvara & Verktyg
  • Java JDK, version 17 eller senare
  • MS Visual Code || JetBrains IntelliJ IDEA

Detta får du lära dig på kursen

Här är ett sammandrag i punktform av vad du får lära dig på kursen. Eftersom kursmaterialet är författat på engelska, så återger vi sammandraget också på engelska.

  • Write Java programs with lambda expressions
  • Be able to write programs with data streams / pipeline chains using Stream
  • Be able to write programs with asynchronous execution using CompletableFuture
  • Be able to use the new classes for dates, times and intervals
  • Design Java applications with modules
  • Understand how modules are dependent on each other
  • Create a dedicated and streamlined JRE for a Java program, using jlink
  • Be able to implement interfaces with private methods
  • Be able to implement a pipeline of OS processes

Kursdatum

Här ser du vilka kursdatum som är tillgängliga. Klicka på en av datumknapparna för att anmäla dig till ett kurstillfälle. På kursen pratar läraren svenska, medan vårt kursmaterial alltid är författat på engelska.

Missa inte vår samfaktureringsrabatt! Är ni fler personer från samma företag/organisation som går på samma kurs, rabatteras tillkommande personer med 25%. Ni anmäler er till kursen en och en, men uppger samma företag, så ordnar vi resten. Samtliga deltagare från samma företag ingår på samma faktura, den första till fullt pris och resterande till rabatterat pris.

Klassrum

Du sitter bekvämt i ett av våra klassrum, vilka finns centralt placerade i Stockholms innerstad.

I priset ingår tryckt kursmaterial (och som PDF), samt kaffe/te med smörgås på förmiddagen och kaffe/te med bulle på eftermiddagen.

Pris: 18 000 kr + moms

Fjärrkurs

Du sitter bekvämt framför datorn och deltar i kursen via internet. Vi använder programvaran Zoom för alla våra fjärrkurser.

I priset ingår kursmaterial som PDF.

Pris: 14 000 kr + moms

Företagsinternt

Om ni är tre eller fler personer från samma företag eller organisation, kan ni beställa en företagsanpassad kurs. Då håller vi kursen på ett datum som passar er. Antingen på plats i era lokaler eller som en fjärrkurs. Vi kan också hålla den muntliga framställningen på engelska.

Klicka på knappen nedan för att be om en offert.

Företagsanpassad Kurs

Kursinnehåll

Eftersom kursmaterialet är författat på engelska, så återger vi innehållet också på engelska.

The Java Time-Line

  • Language evolution
  • New Java version twice a year
  • Oracle’s new licensing strategy with Java 11 and onward
  • Using OpenJDK

JShell - The Java REPL

  • What is JShell
  • Usage
  • Built-in commands
  • Understanding snippets
  • Using jshell from within a Java program

Selected Features of Java 9/10/.../latest

  • Automatic type inference of local variables
  • Direct compilation and execution of single-source Java programs
  • Writing Java programs as shell scripts
  • The new system logger

Functional Interfaces

Functional interfaces is a syntactic foundation for lambda expressions covered in the next chapter. Here we discuss what it is and other syntactic enhancements of interfaces in Java to support the introduction of lambda expressions.

  • What is a functional interface
  • Default method
  • Method and constructor reference
  • Functional interfaces in the Java API

Lambda Expressions

Lambda expressions (aka closures or anonymous functions) is much welcome addition to the Java syntax, and the fundamental building block on virtually almost everything else we cover in this course.

  • What is a lambda expression (aka closure)
  • Basic syntax
  • Dealing with free variables
  • Limitations of the type system
  • Currying

Selected Java API Class Updates

Of course, have all the collection classes been augmented to support lambdas. Here we walk you through the changes both for collection classes and others as well.

  • Review of the most important container classes
  • Lambda oriented methods in the collection classes
  • Optional
  • The Java 8 API explorer

Switch Expressions

The switch statement have been modified to also act as an expression. Here we show you the new syntax and discuss what we might see in future versions of Java.

Records

Records are a simplified form of classes and also immutable. For simple use cases, such as value types, records are a perfect fit.

Data Stream Pipelines

Java has always been about data-structures and its organization. What you did inside the method of a class was left to your discretion, until now. Say hello, to data streams. After you have seen the merits of writing functional code as a pipeline chain of filters, transformations and aggregators, you will never go back. Trust us on this.

  • What is stream and pipeline
  • Stream sources
  • Bounded and unbounded streams
  • Number streams
  • Parallel streams
  • Filters and matchers
  • Mappers and aggregators
  • Numeric aggregators
  • Understanding collect()
  • Understanding reduce()
  • Using the Collectors utility
  • Special filters
  • Using Map and FlatMap
  • Sorting and shuffling
  • The Java 8 Streams Cheat Sheet

Modules

What is modules in Java 9 (JPMS).

  • Changes to your source code directory organization
  • The module-info descriptor
  • Overview of the sub-divided Java API into modules
  • Changes to the JDK install directory
  • Developing a small multi-modules application
  • JUNit5 test suite
  • Project directory content
  • Execution on the command-line, using the java command
  • How to create module JAR files
  • How to make a module JAR file “executable”
  • Execution based on a module JARs
  • Complete shell-script for compilation, packaging and execution
  • Listing dependencies with jdeps
  • Creating a shrink-wrapped JRE using jlink
  • Executing a Java application based on an shrink-wrapped JRE
  • JMOD, a new archive file format

Threaded Computation

Short overview of how the threading support has evolved in Java and a motivator and background for the next chapter.

  • Execution models
  • What is a thread
  • Concurrency problems to bw aware of
  • Thread-safe data-structures introduced in Java 5
  • Using thread-pools (aka Executors)
  • Usage of interface Callable
  • Understanding and using Future
  • Fork/Join concurrency introduced in Java 7
  • Using jSoup to scrape HTML pages and different ways of running several scraping tasks in parallel

Asynchronous Computation

Asynchronous computation has over the last half-decade emerged as the most important computation paradigm, because of how efficient it handles system resources and scales way beyond threaded computation. In this chapter you will learn all you need to know in order to write you own asynchronous computation chains using the new CompletableFuture class. We will also show you how to combine Stream with CompletableFuture.

  • Limitations of threaded computation
  • What is asynchronous computation
  • Limitations of Future
  • Using call-back functions
  • Limitations of the call-back model
  • The boomerang effect
  • Interface CompletionStage
  • Class CompletableFuture and what it does
  • Time capped computation using a promise
  • Creating an async stage using supplyAsync()
  • Asynchronous stage chains
  • Delayed computation
  • Transforming data in a stage chain using thenApply()
  • Composing chains using thenCompose()
  • Combining chains using thenCombine()
  • Waiting the completion of many stage chains
  • Using Stream to assemble partial results in an async stage chain
  • Transforming and handle exceptions
  • Running async stages in a thread pool, aka parallel computation
  • Understanding the *Async() suffix

Date and Time

First we had java.util.Date, with its millennium bug problem. Then came java.util.Calendar as a mere overkill and then nothing for two decades. Finally, java.time has arrived as a proper solution for dealing with time, date, duration and time-zones.

  • Clock
  • ZoneId
  • Instant
  • LocalTime och LocalDate
  • Factory methods
  • Builders

File I/O

Overview of java.nio classes. Most of them was introduced before Java 8, but many has then been updated to support lambdas and streams processing.

  • Concepts and abstractions in java.nio
  • File systems support
  • Understanding Path
  • Useful utility classes, such as Files and Paths

OS Processes

  • Obtaining meta-data for native processes
  • Listing native processes
  • Creating a communicating pipeline of native processes
  • Improved syntax for auto-closable try-statements

HTTP Client

  • What is the new HTTP Client
  • How is it better than HttpURLConnection
  • Synchronous vs. asynchronous HTTP invocations
  • Demonstration of a simple CRUD invocation sequence to a REST-WS Java server

JVM Oriented Improvements

  • Contents of the JDK 9 installation directory
  • Multi-release JAR files (MRJAR)
  • Obsolete tools
  • New way of generating JNI C++ headers
  • What is the G1 gc and how does it differ from classical gc algorithms
  • GC settings removed