Java Coding Problems Review

Java Coding Problems Review hackernoon.com3 months ago in #Dev Love21

I recently bought Java Coding Problems by Anghel Leonard because the topics covered in this book interested me as a Java trainer. I decided to buy it after I saw the TOC here. Since Java has started to evolve quite fast is hard to keep myself up to date and is quite easy to miss new Java features or to not have time to explore them in detail.  I bought the paperback which is quite heavy. The book has 800 pages. But, obviously, what matters the most is the content. As a quick hint: you can count on the 360 applications containing 1,000 examples. Book Structure The book is structured in 13 chapters that covers 260 problems ranging Java 8 to Java 13. Mainly, the author uses the crafted problems as a pretext to cover all Java 8-12 features. From popular features such as Java streams or Optional to less popular features such as Java 11 nest-based access control (nests). Chapters Overview Chapter 1: Strings, Numbers, and Math Chapter 2: Objects, Immutability, and Switch Expressions Chapter 3: Working with Date and Time Chapter 4: Type Inference Chapter 5: Arrays, Collections, and Data Structures Chapter 6: Java I/O Paths, Files, Buffers, Scanning, and Formatting Chapter 7: Java Reflection Classes, Interfaces, Constructors, Methods, and Fields Chapter 8: Functional Style Programming –Fundamentals and Design Patterns Chapter 9: Functional Style Programming – Deep Dive Chapter 10: Concurrency – Thread Pools, Callables, and Synchronizers Chapter 11: Concurrency – Deep Dive Chapter 12: Optional Chapter 13: HTTP Client and WebSocket APIs Chapter 1: Strings, Numbers, and Math This chapter includes 39 problems that involve strings, numbers, and mathematical operations. The chapter starts with a bunch of classical problems for strings such as counting duplicates, reversing a string, and removing white spaces. The chapter continues with problems dedicated to numbers and mathematical operations such as summing two large numbers, operation overflow, comparing two unsigned numbers, computing the floor of a division and a modulus, and much more. Each problem is passed through several solutions, including Java 8 functionalstyle. Moreover, the chapter covers problems that futures added in JDK 9, 10, 11, and 12. Chapter 2: Objects, Immutability, and Switch Expressions This includes 18 problems that involve objects, immutability, and switchexpressions. The chapter starts with several problems about dealing with null references. It continues with problems regarding checking indexes, equals() and hashCode(), and immutability (for example, writing immutable classes and passing/returning mutable objects from immutable classes). The last part of the chapter deals with cloning objects and JDK 12 switch expressions. Chapter 3: Working with Date and Time This chapter includes 20 problems that involve date and time. These problems are meant to cover a wide range of topics (converting, formatting, adding, subtracting, defining periods/durations, computing, and so on) via Date, Calendar, LocalDate, LocalTime, LocalDateTime, ZoneDateTime, OffsetDateTime, OffsetTime, Instant, and so on. By the end of this chapter, you will have no problems shaping date and time to conform to your application’s needs. Chapter 4: Type Inference This chapter includes 21 problems that involve JEP 286, Java Local Variable Type Inference (LVTI), or the var type. These problems have been carefully crafted to reveal the best practices and common mistakes involved in using var.  » Read More

Like to keep reading?

This article first appeared on If you'd like to keep reading, follow the white rabbit.

View Full Article

Leave a Reply