Lambdas, functional interfaces, streams, Optional and the date-time API from Java 8, plus var, records and modern switch from later versions. Every lesson traces a real program line by line.
Java · intermediate · 13 lessons · 1 h 35 min · free
What you'll learn
Write lambdas and method references, and know the four core functional interfaces
Watch stream pipelines process items one at a time, lazily
Group, count and join data with collectors
Use Optional, java.time, var, records and switch expressions
Before you start
Core Java
Lessons
Lambdas and Functional Interfaces
Passing behaviour as a value.
Lambda Expressions: Pass behaviour around as a value. Replace a bulky anonymous class with a one-line lambda, and watch it run each time it is used.
Method References: When a lambda only calls an existing method, write Class::method instead. Four kinds: static, of the argument, of an object, and constructors.
Default and Static Interface Methods: Since Java 8, interfaces can contain code: default methods that classes inherit or override, and static helper methods.
The Stream API
Pipelines that filter, transform and summarise data.
Streams: filter, map, collect: Describe what you want from a list as a pipeline. Watch each price travel through filter and map one at a time, and see that nothing runs until collect.
Optional for missing values, and java.time for dates.
Optional: No More null Surprises: Return Optional instead of null when a value might be missing, and handle both cases without a NullPointerException.
The Date and Time API (java.time): LocalDate, Period and ChronoUnit replace the old Date class: clear, unchangeable values with readable methods.
Modern Java (10–21)
var, records, switch expressions and pattern matching.
var: Local Type Inference: Since Java 10, let the compiler work out a local variable's type. Less typing, same strong types.
Records: Data Classes in One Line: A record declares its fields once and gets a constructor, accessors, equals, hashCode and toString for free.
Switch Expressions and Pattern Matching: Modern Java: switch that returns a value with arrows (no break needed), and instanceof that checks and names a type in one step.
Related courses
Core Java Fundamentals: Learn Java from the ground up: how the JVM runs your code, data types, operators, conditionals, loops, methods, arrays, strings, object-oriented programming and exceptions. Every lesson traces a real program line by line. (44 lessons, 10 h 11 min)
Advanced Java: Collections, Generics and More: The Java you need beyond the basics: lists, stacks, queues, maps and sets, iterators, generics, ordering, equals and hashCode, enums, nested classes, immutability and resources. Every lesson traces a real program line by line. (14 lessons, 1 h 41 min)
Java Interview Questions: Classic Java interview programs, traced line by line with the reasoning behind each step. (4 lessons, 1 h 10 min)
Data Structures & Algorithms: Searching, sorting, linked lists, stacks, queues, hash tables, trees, heaps, graphs, backtracking and dynamic programming, in Python. Watch every comparison, swap, pointer and recursive call as it happens: the visual way to prepare for coding interviews. (25 lessons, 3 h 6 min)