11 November 2020

#CoreJava_08

#CoreJava_08

Key Concepts


S.No Topic Sub-Topics
1Java 8 OverviewJava 8 introduction, Why Java 8, Major enhancements, Backward compatibility, Java 8 use cases
2Functional Programming Functional programming basics, Pure functions, Immutability, Stateless behavior, Lambda-driven design
3Lambda Expressions - BasicsLambda syntax, Lambda parameters, Lambda body, Lambda vs anonymous class, Lambda advantages
4Lambda Expressions - AdvancedLambda with collections, Lambda with threads, Lambda with methods, Effectively final variables, Lambda limitations
5Functional Interfaces @FunctionalInterface , Single abstract method, Lambda compatibility, Custom functional interfaces
6Built-in Functional InterfacesPredicate, Function, Consumer, Supplier, Bi-functional interfaces
7Predicate Interfacetest() method, Predicate chaining, and(), or(), negate(), Real-time examples
8Function Interfaceapply() method, Function chaining, compose(), andThen(), Real-time use cases
9Consumer Interfaceaccept() method, Consumer chaining, forEach usage, Logging examples, Printing data
10Supplier Interfaceget() method, Lazy value generation, Supplier vs Function, Factory usage, Random value generation
11Method ReferencesStatic method reference, Instance method reference, Constructor reference, Syntax (::), Lambda replacement
12Stream API - IntroductionWhat is stream, Stream vs collection, Stream pipeline, Intermediate operations, Terminal operations
13Stream CreationStream from collection, Stream.of(), Arrays.stream(), Infinite streams, Empty streams
14Stream Intermediate Operationsfilter(), map(), flatMap(), distinct(), sorted()
15Stream Terminal OperationsforEach(), collect(), reduce(), count(), findFirst()
16Stream CollectorsCollectors.toList(), toSet(), toMap(), groupingBy(), partitioningBy()
17Stream Reduction Operationsreduce() method, Identity value, Accumulator, Combiner, Aggregation examples
18Parallel StreamsparallelStream(), ForkJoinPool, Performance benefits, Thread safety issues, When to use parallel streams
19Optional ClassOptional creation, isPresent(), ifPresent(), orElse(), orElseThrow()
20Default Methods in InterfaceDefault method syntax, Multiple inheritance resolution, Diamond problem, Overriding defaults, Use cases
21Static Methods in InterfaceStatic method rules, Invocation syntax, Difference from default methods, Utility methods, Best practices
22ForEach MethodIterable forEach(), Lambda usage, Method reference usage, Internal iteration, Comparison with loops
23Nashorn JavaScript EngineNashorn overview, JavaScript execution, ScriptEngine API, Java-JS interaction, Use cases
24New Date & Time API - BasicsProblems with old Date API, LocalDate, LocalTime, LocalDateTime, Immutability
25New Date & Time API - AdvancedZonedDateTime, Period, Duration, DateTimeFormatter, Time zones
26CompletableFutureFuture limitations, CompletableFuture basics, Async execution, thenApply(), thenAccept()
27Collectors Grouping & PartitioninggroupingBy(), partitioningBy(), downstream collectors, Multi-level grouping, Real examples
28Stream PerformanceLazy evaluation, Short-circuiting, Stream reuse rules, Avoiding side effects, Performance tuning
29Java 8 Coding PatternsFilter-map-reduce pattern, Functional pipelines, Optional usage patterns, Lambda best practices, Stream refactoring
30Java 8 Revision & Interview PrepJava 8 feature recap, Common interview questions, Coding scenarios, Performance discussions, Best practices

Interview question

Basic Level

  1. What are the major features introduced in Java 8?
  2. Why was Java 8 introduced?
  3. What is functional programming in Java 8?
  4. What is a lambda expression?
  5. What problems do lambda expressions solve?
  6. What is the syntax of a lambda expression?
  7. Difference between lambda expression and anonymous class?
  8. What is a functional interface?
  9. What is @FunctionalInterface annotation?
  10. Can a functional interface have default methods?
  11. Can a functional interface have static methods?
  12. What are built-in functional interfaces?
  13. What is Predicate interface?
  14. What is Function interface?
  15. What is Consumer interface?
  16. What is Supplier interface?
  17. What is method reference?
  18. Types of method references?
  19. What is Stream API?
  20. Why streams are introduced?
  21. Difference between stream and collection?
  22. What is stream pipeline?
  23. What are intermediate operations?
  24. What are terminal operations?
  25. What is forEach() method?

Intermediate Level

  1. How to create a stream?
  2. What is filter() in streams?
  3. What is map() in streams?
  4. Difference between map() and flatMap()?
  5. What is distinct()?
  6. What is sorted()?
  7. What is limit() and skip()?
  8. What is collect()?
  9. What is Collectors class?
  10. What is Collectors.toList()?
  11. What is Collectors.toSet()?
  12. What is Collectors.toMap()?
  13. What is groupingBy()?
  14. What is partitioningBy()?
  15. Difference between groupingBy and partitioningBy?
  16. What is reduce() operation?
  17. What is Optional class?
  18. Why Optional was introduced?
  19. How to create Optional?
  20. Difference between orElse() and orElseGet()?
  21. What is ifPresent()?
  22. What are default methods?
  23. Why default methods are introduced?
  24. What is static method in interface?
  25. Can we override default methods?

Advanced Level

  1. How lambda expressions work internally?
  2. What is effectively final variable?
  3. Why local variables must be effectively final in lambda?
  4. How streams process data internally?
  5. What is lazy evaluation in streams?
  6. What is short-circuiting in streams?
  7. What is findFirst()?
  8. What is findAny()?
  9. Difference between findFirst and findAny?
  10. What is anyMatch(), allMatch(), noneMatch()?
  11. What are parallel streams?
  12. Difference between stream() and parallelStream()?
  13. When should we use parallel streams?
  14. Problems with parallel streams?
  15. What is ForkJoinPool?
  16. How parallel stream uses ForkJoinPool?
  17. What is Java 8 Date and Time API?
  18. Problems with old Date API?
  19. What is LocalDate?
  20. What is LocalTime?
  21. What is LocalDateTime?
  22. What is ZonedDateTime?
  23. What is Period?
  24. What is Duration?
  25. What is DateTimeFormatter?

Expert Level

  1. How groupingBy works internally?
  2. What are downstream collectors?
  3. How to perform multi-level grouping?
  4. How reduce() works internally?
  5. Difference between reduce() and collect()?
  6. How Optional avoids NullPointerException?
  7. Anti-patterns of Optional?
  8. Exception handling in lambda expressions?
  9. Exception handling in streams?
  10. How to debug stream pipelines?
  11. Performance comparison: stream vs loop?
  12. When streams should be avoided?
  13. CompletableFuture introduction?
  14. Difference between Future and CompletableFuture?
  15. What is thenApply()?
  16. What is thenAccept()?
  17. What is thenCombine()?
  18. What is async execution in Java 8?
  19. What is Nashorn JavaScript engine?
  20. Use cases of Nashorn?
  21. Best practices for lambda expressions?
  22. Best practices for Stream API?
  23. Java 8 real-time project use cases?
  24. Common Java 8 interview traps?
  25. Java 8 coding round expectations?

Related Topics


   Functional Interfaces   
   Lambda Expressions   
   Stream API   
   Built-in Functional Interfaces   
   Optional Class   
   Default Method