Java 8 & Streams
Streams from basics to internals: filter, map, sorting, reduce, collectors, groupingBy, flatMap, Optional, primitive streams, functional interfaces, method references, parallel streams, custom collectors, Spliterator and the java.time API.
Stream Basics
What a Stream is, Collection vs Stream, internal iteration, the source → intermediate → terminal pipeline, laziness and reuse.
Filtering
filter() with Predicates, findFirst vs findAny, anyMatch/allMatch/noneMatch and short-circuiting — with Spring Boot examples.
Mapping
Transforming elements with map(), Entity → DTO conversion, method references and primitive mapping with mapToInt/Long/Double.
Sorting
sorted(), natural and reverse order, Comparator.comparing, thenComparing, nulls handling, stability and top-N patterns.
distinct(), limit() and skip()
Removing duplicates, taking the first N, offsetting, pagination with skip + limit, order of operations and Nth-highest problems.
Reduction Operations
Combining a stream into one value — reduce() forms, identity/accumulator/combiner, sum, count, max, min, average and parallel reduction.
Collectors
Turning streams into results — toList, toSet, toMap (and duplicate keys), joining, counting, summing, averaging and summarizing.
groupingBy() and partitioningBy()
The most important Stream topic — grouping by a key, downstream collectors, counting/summing/averaging per group, multi-level grouping and true/false partitions.
Advanced Collectors
Combining collectors like Lego blocks — collectingAndThen, mapping, filtering, flatMapping, reducing, teeing and nested collector pipelines.
flatMap()
The most misunderstood Stream operation — flattening nested collections, map() vs flatMap(), chained flatMap, flatMapToInt and null-safe flattening.
Real Stream Interview Problems
From APIs to problem solving — duplicates, frequencies, first non-repeating element, Nth highest, longest string, per-department analytics and anagrams.
Optional
Making absence explicit — of vs ofNullable, why get() is dangerous, ifPresent, orElse vs orElseGet, orElseThrow, and map/filter/flatMap on Optional.
Primitive Streams
IntStream, LongStream and DoubleStream — why they exist, boxing overhead, sum/average/max/min, summaryStatistics, boxed() and OptionalInt.
Generating Streams
Creating streams without a collection — range(), rangeClosed(), iterate(), generate(), infinite streams, Fibonacci, UUIDs and business days.
Functional Interfaces
The engine behind Streams — @FunctionalInterface, lambdas, Predicate, Function, Consumer, Supplier, UnaryOperator, BinaryOperator, composition and chaining.
Method References
Every form of :: explained — static, specific-object, arbitrary-object and constructor references, array constructors, and when a lambda is better.
Parallel Streams and Performance
How parallelStream() works — Fork/Join, the common pool, ordering, thread safety, associativity, and when parallel makes things slower.
Custom Collectors
The secret behind Collectors.toList() — supplier, accumulator, combiner, finisher, characteristics, and writing your own with Collector.of().
Spliterator and Stream Internals
What happens after list.stream() — Spliterator, trySplit, lazy evaluation, single-use streams, pipeline fusion, short-circuiting and characteristics.
Java 8 Interview Masterclass
How interviewers think — core, Stream, Optional, functional interface, parallel, collector, method reference and internals questions, plus output-based puzzles.
Date and Time API (java.time)
LocalDate, LocalTime, LocalDateTime, ZonedDateTime, Instant, Period, Duration and DateTimeFormatter — the immutable, thread-safe replacement for Date and Calendar.
Stream API Cheat Sheet
Every commonly used Stream method on one page — creation, intermediate and terminal operations, primitive streams, collectors and parallel streams.