Advanced Java 8 Programming

Duration:

4 Days

Audience:

Employees of federal, state and local governments; and businesses working with the government.

This is an intermediate level Java SE (JSE) developer course, designed for experienced Java 8 developers. Attendees should have current hands-on experience in developing basic Java 8 applications.

Course Overview

The Advanced Java 8 Programming is a comprehensive hands-on advanced Java training workshop geared for experienced developers who wish to explore specific advanced programming APIs and techniques.  “Advanced Java” can encompass many skills and meanings.  The agenda below includes common ‘next-level’ Java development tasks beyond a core knowledge base, exploring new features in Java 8 and how to harness and apply them to improve application development efforts and performance.

Our team will collaborate with you to adjust this agenda to target specific challenges or initiatives facing your development team or organization.

Course Objectives

Students who attend Advanced Java 8 Programming will leave this course armed with the required skills to improve their Java applications using sound coding techniques and best practices.

Working within in an engaging, hands-on learning environment, guided by our expert team, attendees will learn to:

  • Understand functional programming means and what it brings to the table
  • Understand how Lambda expressions and functional interfaces can greatly enhance other aspects of Java
  • Use the new Stream constructs to work with Collections and Collectors
  • Become familiar with the methods of the Collection API introduced in Java 8
  • Work with default methods and pass methods as arguments
  • Use the new features to support concurrency in multi-core systems
  • Understand and work with the JavaScript engine Nashorn
  • Explore the Java Virtual Machine (JVM)
  • Work Java and JEE’s version of dependency injection (CDI)
  • Work with WebSockets
  • Use Java Bean validation

Specific Java 8 features that are covered in the course include:

  • Lambda Expressions
  • Streams
  • Collectors
  • Interface methods
  • Lambda expressions and Collections

Topics Covered

Session: Introduction to Lambda Expressions

Lesson: Functional Programming

  • Functional vs OO Programming
  • Anonymous Inner-classes
  • Utility Methods
  • Lambda Expressions

Lesson: Lambda Expressions and Functional Interface

  • Lambda Expression Syntax
  • Functional Interfaces
  • Type Inference in Java 8
  • Method references

Session: Streams

Lesson: Streams

  • Processing Collections of data
  • The Stream interface
  • Reduction and Parallelism
  • Filtering collection data
  • Sorting Collection data
  • Map collection data
  • Find elements in Stream
  • Numeric Streams
  • Create infinite Streams
  • Sources for using Streams

Lesson: Collectors

  • Creating Collections from a Stream
  • Group elements in the Stream
  • Multi-level grouping of elements
  • Partitioning Streams

Session: Additional Java 8 Enhancements

Lesson: Evolving Interfaces

  • Interfaces in Java 8
  • Default methods
  • Static methods
  • Multiple Inheritance?

Lesson: Optional

  • Introduce Optional
  • Implement Optional attributes
  • Lambda expressions and Optional

Lesson: Java 8 Collection Updates

  • Introduce the ConcurrentHashMap
  • Lambda expressions and Collections

Lesson: Java 8 Concurrency Updates

  • The common thread pool
  • Atomic variables
  • LongAdder and LongAccumulator
  • CompletableFuture
  • Non-blocking asynchronous tasks

Lesson: Nashorn JavaScript Engine

  • Working with JavaScript and Java
  • Accessing Nashorn
  • Executing JavaScript from Java
  • Executing Java from JavaScript
  • Implementing a Java Interface
  • Alternatives to Nashorn

Session: Best Practices and Performance

Lesson: Java Virtual Machine

  • Architecture of the JVM
  • Application Execution

Session: Effective Java

Lesson: Objects, Declarations, and Initializations

  • Abstraction and Responsibilities
  • Low Coupling
  • Programming principles
  • Inheritance

Lesson: Exceptions

  • Proper use of Exceptions
  • Managing state in exceptional situations
  • Checked vs. Unchecked Exceptions

Session: Java 8 Performance

Lesson: Performance and Java 8

  • Performance Across Java Versions
  • Tiered Compilation
  • Nashorn versus Java 7’s JavaScript Engine
  • Lambda Expressions versus Inner Classes
  • Impact of Streams versus Collections
  • Date/Time Classes
  • I/O Stream Recommendations
  • Encoding/Decoding
  • Strings and Spring Interning

Session: Contexts and Dependency Injection (CDI)

Lesson: Introduction to CDI

  • Context Dependency Injection (CDI)
  • The @Inject Annotation
  • The @Default Annotation
  • The @Alternative Annotation
  • The @Named Annotation

Lesson: Using CDI

  • Qualifiers
  • @PostConstruct and @PreDestroy
  • The @Produces Annotation

Session: Java API for WebSocket

Lesson: Introduction to WebSocket

  • Java API for WebSocket Overview
  • Using WebSocket in Java EE
  • Endpoint Instances

Lesson: Implementing WebSocket Endpoint

  • Annotated Endpoints
  • Receiving messages
  • Send Response to Client(s)
  • JavaScript to Setup a WebSocket Connection

Session: Java Bean Validation (JSR 349)

Lesson: Introduction to Bean Validation

  • Bean Validation
  • Define Constraints on Object Models
  • Core Validation Annotations
  • Validate Objects and Object Graphs

Lesson: Bean Validation

  • Validate Parameters and Return Values
  • Develop Custom Constraints

Session: Additional Topics (Optional)

Lesson: Java I/O

  • The Java I/O Mechanism
  • Subclasses Accessing Real Data
  • Filter Classes
  • New File IO – NIO
  • NIO Overview