Although this book has been written to cover all the objectives of the OCP Java 8 exam (1Z0‐809), you can use it to prepare the Upgrade Java SE 7 to Java SE 8 OCP exam (1Z0‐810) too.
These are the chapters you have to review:
This table shows the objectives of the exam and the chapter(s) where they are covered:
Objective | Chapter |
---|---|
Lambda Expressions | |
Describe and develop code that uses Java inner classes, including nested class, static class, local class, and anonymous classes | 03. Inner Classes |
Describe and write functional interfaces | 08. Functional Interfaces |
Describe a lambda expression; refactor the code that uses an anonymous inner class to use a lambda expression; describe type inference and target typing | 09. Lambda Expressions |
Using Built-in Lambda Types | |
Describe the interfaces of the java.util.function package | 10. Java Built-In Lambda Interfaces |
Develop code that uses the Function interface | 10. Java Built-In Lambda Interfaces |
Develop code that uses the Consumer interface | 10. Java Built-In Lambda Interfaces |
Develop code that uses the Supplier interface | 10. Java Built-In Lambda Interfaces |
Develop code that uses the UnaryOperator interface | 10. Java Built-In Lambda Interfaces |
Develop code that uses the Predicate interface | 10. Java Built-In Lambda Interfaces |
Develop code that uses the primitive and binary variations of the base interfaces of the java.util.function package | 10. Java Built-In Lambda Interfaces |
Develop code that uses a method reference, including refactoring a lambda expression to a method reference | 11. Method References |
Java Collections and Streams with Lambdas | |
Develop code that iterates a collection by using the forEach() method and method chaining | 13. Iterating and Filtering Collections |
Describe the Stream interface and pipelines | 12. Streams |
Filter a collection by using lambda expressions | 13. Iterating and Filtering Collections |
Identify the operations, on stream, that are lazy | 12. Streams |
Collection Operations with Lambda | |
Develop code to extract data from an object by using the map() method | 17. Peeking, Mapping, Reducing and Collecting |
Search for data by using methods such as findFirst(), findAny(), anyMatch(), allMatch(), and noneMatch() | 15. Data Search |
Describe the unique characteristics of the Optional class | 14. Optional Class |
Perform calculations by using Java Stream methods, such as count(), max(), min(), average(), and sum() | 15. Data Search |
Sort a collection by using lambda expressions | 16. Stream Operations on Collections |
Develop code that uses the Stream.collect() method and Collectors class methods, such as averagingDouble(), groupingBy(), joining(), and partitioningBy() | 17. Peeking, Mapping, Reducing and Collecting |
Develop code that uses parallel streams | 18. Parallel Streams |
Implement decomposition and reduction in streams | 17. Peeking, Mapping, Reducing and Collecting |
Lambda Cookbook | |
Develop code that uses Java SE 8 collection improvements, including Collection.removeIf(), List.replaceAll(), Map.computeIfAbsent(), and Map.computeIfPresent() methods | A1. From Java 6/7 to Java 8 |
Develop code that uses Java SE 8 I/O improvements, including Files.find(), Files.walk(), and lines() methods | 23. Files and Streams |
Use flatMap() methods in the Stream API | 17. Peeking, Mapping, Reducing and Collecting |
Develop code that creates a stream by using the Arrays.stream() and IntStream.range() methods | 12. Streams |
Method Enhancements | |
Add static methods to interfaces | 04. Interfaces |
Define and use a default method of an interface and describe the inheritance rules for the default method | 04. Interfaces |
Use Java SE 8 Date/Time API | |
Create and manage date- and time-based events, including a combination of date and time in a single object, by using LocalDate, LocalTime, LocalDateTime, Instant, Period, and Duration | 21. Core Date/Time Classes |
Work with dates and times across time zones and manage changes resulting from daylight savings, including Format date and times values | 22. Time Zones and Daylight Savings |
Define, create, and manage date‐and time‐based events using Instant, Period, Duration, and TemporalUnit | 21. Core Date/Time Classes |
Just as the Java 7 upgrade exam, you can use this book to prepare the Upgrade to Java SE 8 OCP from Java SE 6 and all prior versions exam (1Z0‐813).
These are the chapters you have to review:
This table shows the objectives of the exam and the chapter(s) where they are covered:
Objective | Chapter |
---|---|
Language Enhancements | |
Develop code that uses String objects in the switch statement, binary literals, and numeric literals, including underscores in literals | A1. From Java 6/7 to Java 8 |
Develop code that uses try-with-resources statements, including using classes that implement the AutoCloseable interface | 19. Exceptions |
Develop code that handles multiple Exception types in a single catch block | 19. Exceptions |
Use static and default methods of an interface including inheritance rules for a default method | 04. Interfaces |
Concurrency | |
Use classes from the java.util.concurrent package including CyclicBarrier and CopyOnWriteArrayList with a focus on the advantages over and differences from the traditional java.util collections | 27. Concurrency |
Use Lock, ReadWriteLock, and ReentrantLock classes in the java.util.concurrent.locks and java.util.concurrent.atomic packages to support lock-free thread-safe programming on single variables | A1. From Java 6/7 to Java 8 27. Concurrency |
Use Executor, ExecutorService, Executors, Callable, and Future to execute tasks using thread pools | 26. Thread Basics |
Use the parallel Fork/Join Framework | 28. Fork/Join Framework |
Localization | |
Describe the advantages of localizing an application and developing code that defines, reads, and sets the locale with a Locale object | 30. Localization |
Build a resource bundle for a locale and call a resource bundle from an application | 30. Localization |
Create and manage date‐and time‐based events by using LocalDate, LocalTime, LocalDateTime, Instant, Period, and Duration, including a combination of date and time in a single object | 21. Core Date/Time Classes |
Format dates, numbers, and currency values for localization with the NumberFormat and DateFormat classes, including number and date format patterns | A1. From Java 6/7 to Java 8 |
Work with dates and times across time zones and manage changes resulting from daylight savings | 22. Time Zones and Daylight Savings |
Java File I/O (NIO.2) | |
Operate on file and directory paths by using the Paths class | 24. NIO.2 |
Check, delete, copy, or move a file or directory by using the Files class | 24. NIO.2 |
Recursively access a directory tree by using the DirectoryStream and FileVisitor interfaces | A1. From Java 6/7 to Java 8 |
Find a file by using the PathMatcher interface, and use Java SE 8 I/O improvements, including Files.find(), Files.walk(), and lines() methods | A1. From Java 6/7 to Java 8 25. Files and Streams |
Observe the changes in a directory by using the WatchService interface | A1. From Java 6/7 to Java 8 |
Lambda | |
Define and write functional interfaces and describe the interfaces of the java.util.function package | 08. Functional Interfaces |
Describe a lambda expression; refactor the code that uses an anonymous inner class to use a lambda expression; describe type inference and target typing | 09. Lambda Expressions |
Develop code that uses the built-in interfaces included in the java.util.function package, such as Function, Consumer, Supplier, UnaryOperator, Predicate, and Optional APIs, including the primitive and binary variations of the interfaces | 10. Java Built-In Lambda Interfaces |
Develop code that uses a method reference, including refactoring a lambda expression to a method reference | 11. Method References |
Java Collections | |
Develop code that uses diamond with generic declarations | 06. Generics |
Develop code that iterates a collection, filters a collection, and sorts a collection by using lambda expressions | 13. Iterating and Filtering Collections |
Search for data by using methods, such as findFirst(), findAny(), anyMatch(), allMatch(), and noneMatch() | 15. Data Search |
Perform calculations on Java Streams by using count, max, min, average, and sum methods and save results to a collection by using the collect method and Collector class, including the averagingDouble, groupingBy, joining, partitioningBy methods | 17. Peeking, Mapping, Reducing and Collecting |
Develop code that uses Java SE 8 collection improvements, including the Collection.removeIf(), List.replaceAll(), Map.computeIfAbsent(), and Map.computeIfPresent() methods | A1. From Java 6/7 to Java 8 |
Develop code that uses the merge(), flatMap(), and map() methods on Java Streams | 17. Peeking, Mapping, Reducing and Collecting |
Java Streams | |
Describe the Stream interface and pipelines; create a stream by using the Arrays.stream() and IntStream.range() methods; identify the lambda operations that are lazy | 12. Streams |
Develop code that uses parallel streams, including decomposition operation and reduction operation in streams | 18. Parallel Streams |