Introduction |
|
xix | |
Assessment Test |
|
xxxviii | |
Chapter 1 Advanced Class Design |
|
1 | (46) |
|
|
2 | (5) |
|
|
2 | (2) |
|
Overloading and Overriding |
|
|
4 | (1) |
|
|
5 | (1) |
|
|
6 | (1) |
|
|
6 | (1) |
|
|
7 | (2) |
|
Understanding Virtual Method Invocation |
|
|
9 | (2) |
|
Annotating Overridden Methods |
|
|
11 | (2) |
|
Coding equals, hash Code, and toString |
|
|
13 | (7) |
|
|
13 | (2) |
|
|
15 | (3) |
|
|
18 | (2) |
|
|
20 | (4) |
|
Using Enums in Switch Statements |
|
|
21 | (1) |
|
Adding Constructors, Fields, and Methods |
|
|
22 | (2) |
|
|
24 | (9) |
|
|
25 | (2) |
|
|
27 | (2) |
|
|
29 | (2) |
|
|
31 | (2) |
|
|
33 | (1) |
|
|
34 | (2) |
|
|
36 | (11) |
Chapter 2 Design Patterns and Principles |
|
47 | (56) |
|
|
48 | (4) |
|
|
51 | (1) |
|
Introducing Functional Programming |
|
|
52 | (9) |
|
Defining a Functional Interface |
|
|
53 | (2) |
|
Implementing Functional Interfaces with Lambdas |
|
|
55 | (5) |
|
Applying the Predicate Interface |
|
|
60 | (1) |
|
Implementing Polymorphism |
|
|
61 | (5) |
|
Distinguishing between an Object and a Reference |
|
|
63 | (1) |
|
Casting Object References |
|
|
64 | (2) |
|
Understanding Design Principles |
|
|
66 | (9) |
|
|
66 | (3) |
|
|
69 | (2) |
|
Applying the Is-a Relationship |
|
|
71 | (2) |
|
Applying the Has-a Relationship |
|
|
73 | (1) |
|
|
74 | (1) |
|
Working with Design Patterns |
|
|
75 | (18) |
|
Applying the Singleton Pattern |
|
|
76 | (6) |
|
Creating Immutable Objects |
|
|
82 | (4) |
|
Using the Builder Pattern |
|
|
86 | (3) |
|
Creating Objects with the Factory Pattern |
|
|
89 | (4) |
|
|
93 | (1) |
|
|
93 | (2) |
|
|
95 | (8) |
Chapter 3 Generics and Collections |
|
103 | (68) |
|
Reviewing OCA Collections |
|
|
104 | (4) |
|
|
104 | (1) |
|
|
105 | (1) |
|
Wrapper Classes and Autoboxing |
|
|
106 | (1) |
|
|
107 | (1) |
|
|
108 | (16) |
|
|
109 | (3) |
|
|
112 | (2) |
|
|
114 | (1) |
|
Interacting with Legacy Code |
|
|
114 | (3) |
|
|
117 | (5) |
|
|
122 | (2) |
|
Using Lists, Sets, Maps, and Queues |
|
|
124 | (19) |
|
Common Collections Methods |
|
|
125 | (2) |
|
|
127 | (5) |
|
|
132 | (2) |
|
Using the Queue Interface |
|
|
134 | (4) |
|
|
138 | (2) |
|
Comparing Collection Types |
|
|
140 | (3) |
|
Comparator vs. Comparable |
|
|
143 | (7) |
|
|
143 | (3) |
|
|
146 | (4) |
|
|
150 | (2) |
|
|
152 | (7) |
|
|
152 | (2) |
|
|
154 | (1) |
|
|
155 | (1) |
|
Looping through a Collection |
|
|
155 | (1) |
|
Using New Java 8 Map APIs |
|
|
155 | (4) |
|
|
159 | (2) |
|
|
161 | (1) |
|
|
162 | (9) |
Chapter 4 Functional Programming |
|
171 | (62) |
|
Using Variables in Lambdas |
|
|
172 | (1) |
|
Working with Built-In Functional Interfaces |
|
|
173 | (9) |
|
|
174 | (1) |
|
Implementing Consumer and BiConsumer |
|
|
175 | (2) |
|
Implementing Predicate and BiPredicate |
|
|
177 | (1) |
|
Implementing Function and BiFunction |
|
|
178 | (2) |
|
Implementing UnaryOperator and BinaryOperator |
|
|
180 | (1) |
|
Checking Functional Interfaces |
|
|
181 | (1) |
|
|
182 | (3) |
|
|
185 | (20) |
|
|
188 | (1) |
|
Using Common Terminal Operations |
|
|
189 | (7) |
|
Using Common Intermediate Operations |
|
|
196 | (4) |
|
Putting Together the Pipeline |
|
|
200 | (4) |
|
|
204 | (1) |
|
|
205 | (8) |
|
Creating Primitive Streams |
|
|
205 | (3) |
|
Using Optional with Primitive Streams |
|
|
208 | (2) |
|
|
210 | (1) |
|
Learning the Functional Interfaces for Primitives |
|
|
210 | (3) |
|
Working with Advanced Stream Pipeline Concepts |
|
|
213 | (10) |
|
Linking Streams to the Underlying Data |
|
|
213 | (1) |
|
|
214 | (3) |
|
|
217 | (6) |
|
|
223 | (1) |
|
|
224 | (2) |
|
|
226 | (7) |
Chapter 5 Dates, Strings, and Localization |
|
233 | (50) |
|
Working with Dates and Times |
|
|
234 | (19) |
|
|
235 | (6) |
|
Manipulating Dates and Times |
|
|
241 | (3) |
|
|
244 | (3) |
|
|
247 | (4) |
|
Accounting for Daylight Savings Time |
|
|
251 | (2) |
|
Reviewing the String class |
|
|
253 | (2) |
|
Adding Internationalization and Localization |
|
|
255 | (18) |
|
|
256 | (2) |
|
|
258 | (9) |
|
|
267 | (3) |
|
Formatting Dates and Times |
|
|
270 | (3) |
|
|
273 | (1) |
|
|
274 | (2) |
|
|
276 | (7) |
Chapter 6 Exceptions and Assertions |
|
283 | (42) |
|
|
284 | (5) |
|
|
284 | (1) |
|
|
285 | (1) |
|
|
286 | (2) |
|
|
288 | (1) |
|
|
289 | (1) |
|
Creating Custom Exceptions |
|
|
289 | (2) |
|
|
291 | (5) |
|
|
296 | (9) |
|
Try-With-Resources Basics |
|
|
298 | (2) |
|
|
300 | (2) |
|
|
302 | (3) |
|
|
305 | (1) |
|
|
305 | (3) |
|
|
308 | (6) |
|
|
308 | (1) |
|
|
309 | (1) |
|
|
310 | (4) |
|
|
314 | (1) |
|
|
315 | (1) |
|
|
316 | (9) |
Chapter 7 Concurrency |
|
325 | (80) |
|
|
327 | (8) |
|
Distinguishing Thread Types |
|
|
328 | (1) |
|
Understanding Thread Concurrency |
|
|
328 | (2) |
|
|
330 | (1) |
|
|
331 | (3) |
|
|
334 | (1) |
|
Creating Threads with the ExecutorService |
|
|
335 | (15) |
|
Introducing the Single-Thread Executor |
|
|
335 | (2) |
|
Shutting Down a Thread Executor |
|
|
337 | (1) |
|
|
338 | (2) |
|
|
340 | (5) |
|
|
345 | (3) |
|
Increasing Concurrency with Pools |
|
|
348 | (2) |
|
Synchronizing Data Access |
|
|
350 | (8) |
|
Protecting Data with Atomic Classes |
|
|
352 | (2) |
|
Improving Access with Synchronized Blocks |
|
|
354 | (2) |
|
|
356 | (1) |
|
Understanding the Cost of Synchronization |
|
|
357 | (1) |
|
Using Concurrent Collections |
|
|
358 | (8) |
|
Introducing Concurrent Collections |
|
|
358 | (1) |
|
Understanding Memory Consistency Errors |
|
|
359 | (1) |
|
Working with Concurrent Classes |
|
|
360 | (5) |
|
Obtaining Synchronized Collections |
|
|
365 | (1) |
|
Working with Parallel Streams |
|
|
366 | (11) |
|
Creating Parallel Streams |
|
|
366 | (1) |
|
Processing Tasks in Parallel |
|
|
367 | (5) |
|
Processing Parallel Reductions |
|
|
372 | (5) |
|
Managing Concurrent Processes |
|
|
377 | (10) |
|
|
377 | (4) |
|
Applying the Fork/Join Framework |
|
|
381 | (6) |
|
Identifying Threading Problems |
|
|
387 | (5) |
|
|
387 | (4) |
|
|
391 | (1) |
|
|
392 | (1) |
|
|
393 | (1) |
|
|
394 | (11) |
Chapter 8 IO |
|
405 | (48) |
|
Understanding Files and Directories |
|
|
406 | (5) |
|
Conceptualizing the File System |
|
|
406 | (1) |
|
Introducing the File Class |
|
|
407 | (4) |
|
|
411 | (9) |
|
|
411 | (1) |
|
|
412 | (6) |
|
|
418 | (2) |
|
|
420 | (17) |
|
The FilelnputStream and FileOutputStream Classes |
|
|
420 | (4) |
|
The FileReader and FileWriter classes |
|
|
424 | (2) |
|
The ObjectlnputStream and ObjectOutputStream Classes |
|
|
426 | (6) |
|
The PrintStream and PrintWriter Classes |
|
|
432 | (3) |
|
|
435 | (2) |
|
|
437 | (5) |
|
|
437 | (1) |
|
|
438 | (4) |
|
|
442 | (1) |
|
|
443 | (2) |
|
|
445 | (8) |
Chapter 9 NIO.2 |
|
453 | (52) |
|
|
454 | (6) |
|
|
455 | (1) |
|
|
456 | (4) |
|
Interacting with Paths and Files |
|
|
460 | (18) |
|
Providing Optional Arguments |
|
|
461 | (1) |
|
|
462 | (9) |
|
|
471 | (7) |
|
Understanding File Attributes |
|
|
478 | (9) |
|
Discovering Basic File Attributes |
|
|
478 | (5) |
|
Improving Access with Views |
|
|
483 | (4) |
|
Presenting the New Stream Methods |
|
|
487 | (7) |
|
Conceptualizing Directory Walking |
|
|
487 | (1) |
|
|
488 | (2) |
|
|
490 | (1) |
|
Listing Directory Contents |
|
|
491 | (1) |
|
|
492 | (2) |
|
Comparing Legacy File and NIO.2 Methods |
|
|
494 | (1) |
|
|
495 | (1) |
|
|
495 | (2) |
|
|
497 | (8) |
Chapter 10 JDBC |
|
505 | (42) |
|
Introducing Relational Databases and SQL |
|
|
507 | (4) |
|
Identifying the Structure of a Relational Database |
|
|
508 | (2) |
|
Writing Basic SQL Statements |
|
|
510 | (1) |
|
Introducing the Interfaces of JDBC |
|
|
511 | (2) |
|
|
513 | (5) |
|
|
513 | (2) |
|
Getting a Database Connection |
|
|
515 | (3) |
|
|
518 | (2) |
|
Choosing a ResultSet Type |
|
|
519 | (1) |
|
Choosing a ResultSet Concurrency Mode |
|
|
520 | (1) |
|
|
520 | (4) |
|
Getting Data from a ResultSet |
|
|
524 | (9) |
|
|
524 | (2) |
|
Getting Data for a Column |
|
|
526 | (3) |
|
|
529 | (4) |
|
Closing Database Resources |
|
|
533 | (2) |
|
|
535 | (1) |
|
|
536 | (1) |
|
|
537 | (2) |
|
|
539 | (8) |
Appendix A Answers to Review Questions |
|
547 | (28) |
|
Chapter 1: Advanced Class Design |
|
|
548 | (2) |
|
Chapter 2: Design Patterns and Principles |
|
|
550 | (3) |
|
Chapter 3: Generics and Collections |
|
|
553 | (3) |
|
Chapter 4: Functional Programming |
|
|
556 | (2) |
|
Chapter 5: Dates, Strings, and Localization |
|
|
558 | (2) |
|
Chapter 6: Exceptions and Assertions |
|
|
560 | (1) |
|
|
561 | (4) |
|
|
565 | (3) |
|
|
568 | (3) |
|
|
571 | (4) |
Appendix B Study Tips |
|
575 | (20) |
|
|
576 | (6) |
|
|
576 | (2) |
|
|
578 | (1) |
|
Creating and Running Sample Applications |
|
|
579 | (3) |
|
|
582 | (13) |
|
Understanding the Question |
|
|
582 | (5) |
|
Taking Advantage of the Exam Software |
|
|
587 | (1) |
|
Using the Provided Writing Material |
|
|
587 | (3) |
|
|
590 | (1) |
|
|
591 | (2) |
|
Getting a Good Night's Rest |
|
|
593 | (2) |
Appendix C Upgrading from Java 6 or Earlier |
|
595 | (54) |
|
Enhancing the Java Language |
|
|
596 | (7) |
|
Using the Diamond Operator |
|
|
596 | (1) |
|
|
597 | (1) |
|
Making Decisions with Switch |
|
|
598 | (5) |
|
|
603 | (4) |
|
Using DecimalFormat Flags |
|
|
603 | (1) |
|
|
603 | (1) |
|
|
604 | (1) |
|
|
605 | (1) |
|
|
606 | (1) |
|
|
607 | (10) |
|
Understanding the Lock Framework |
|
|
607 | (3) |
|
|
610 | (4) |
|
Understanding Read/Write Locks |
|
|
614 | (1) |
|
Using a ReentrantReadWriteLock |
|
|
615 | (2) |
|
|
617 | (16) |
|
|
618 | (7) |
|
Monitoring a Directory for Changes |
|
|
625 | (8) |
|
|
633 | (1) |
|
|
633 | (2) |
|
|
635 | (10) |
|
|
645 | (4) |
Index |
|
649 | |