Book Image

Java Coding Problems

By : Anghel Leonard
Book Image

Java Coding Problems

By: Anghel Leonard

Overview of this book

The super-fast evolution of the JDK between versions 8 and 12 has increased the learning curve of modern Java, therefore has increased the time needed for placing developers in the Plateau of Productivity. Its new features and concepts can be adopted to solve a variety of modern-day problems. This book enables you to adopt an objective approach to common problems by explaining the correct practices and decisions with respect to complexity, performance, readability, and more. Java Coding Problems will help you complete your daily tasks and meet deadlines. You can count on the 300+ applications containing 1,000+ examples in this book to cover the common and fundamental areas of interest: strings, numbers, arrays, collections, data structures, date and time, immutability, type inference, Optional, Java I/O, Java Reflection, functional programming, concurrency and the HTTP Client API. Put your skills on steroids with problems that have been carefully crafted to highlight and cover the core knowledge that is accessed in daily work. In other words (no matter if your task is easy, medium or complex) having this knowledge under your tool belt is a must, not an option. By the end of this book, you will have gained a strong understanding of Java concepts and have the confidence to develop and choose the right solutions to your problems.
Table of Contents (15 chapters)
Free Chapter
1
Strings, Numbers, and Math
2
Objects, Immutability, and Switch Expressions
3
Working with Date and Time
5
Arrays, Collections, and Data Structures
6
Java I/O Paths, Files, Buffers, Scanning, and Formatting
7
Java Reflection Classes, Interfaces, Constructors, Methods, and Fields
8
Functional Style Programming - Fundamentals and Design Patterns
9
Functional Style Programming - a Deep Dive
10
Concurrency - Thread Pools, Callables, and Synchronizers
11
Concurrency - Deep Dive
13
The HTTP Client and WebSocket APIs

Problems

Use the following problems to test your Java Reflection API programming prowess. I strongly encourage you to give each problem a try before you turn to the solutions and download the example programs:

  1. Inspecting packages: Write several examples for inspecting Java packages (for example, names, a list of classes, and so on).
  2. Inspecting classes and superclasses: Write several examples for inspecting classes and superclasses (for example, get Class via the class name, modifiers, implemented interfaces, constructors, methods, and fields).
  3. Instantiating via a reflected constructor: Write a program that creates instances via reflection.
  1. Getting the annotation of a receiver type: Write a program that gets the annotation on a receiver type.
  2. Getting synthetic and bridge constructs: Write a program that gets synthetic and bridge constructs via reflection.
  3. Checking the variable...