Part 2 of this four-part series on Java SE Web services showed how to use the JAX-WS API to develop SOAP-based Web services. JAX-WS also supports RESTful-based Web services, which this article shows how to develop. It first defines and then builds and runs a library Web service, and next defines, builds, and runs a simple client that accesses this service.
Defining a library web service
The library Web service, which I’ve named Library, manages a library of books with … Read the rest
Datastructures and algorithms are essential to computer science, which is the study of data, its representation in memory, and its transformation from one form to another. In programming, we use datastructures to store and organize data, and we use algorithms to manipulate the data in those structures. The more you understand about datastructures and algorithms, the more efficient your Java programs will be.
This article launches a three-part series introducing datastructures and algorithms. In Part 1, you’ll learn what a … Read the rest
Exploring puzzling code to figure out why it doesn’t do what seems obvious is one way to improve your programming skills. In this post, I introduce you to various Java-oriented puzzlers from Jens Dietrich, Joshua Bloch and Neal Gafter, and myself.
Java Library Evolution Puzzlers
Q: What is the Java Library Evolution Puzzlers?
A: The Java Library Evolution Puzzlers is a survey focused on changing Java libraries and then recompiling their client programs’ source codes or running these clients unchanged … Read the rest
Understanding type compatibility is fundamental to writing good Java programs, but the interplay of variances between Java language elements can seem highly academic to the uninitiated. This two-part article is for software developers ready to tackle the challenge! Part 1 revealed the covariant and contravariant relationships between simpler elements such as array types and generic types, as well as the special Java language element, the wildcard. Part 2 explores type dependency in the Java Collections API, in generics, and in … Read the rest
JEP 266: More Concurrency Updates defines an interoperable publish-subscribe framework for reactive streams, enhancements to the
java.util.concurrent.CompletableFuture class, and various other improvements. This post wraps up my series on Java 9’s other new enhancements by acquainting you with these concurrency enhancements.
Publish-subscribe framework for reactive streams
Java 9 includes a publish-subscribe framework for reactive streams. In this section, I first introduce the concept of reactive streams and then present this publish-subscribe framework.
Introducing reactive streams
Data processing has evolved from … Read the rest
The first half of this tutorial introduced you to regular expressions and the Regex API. You learned about the
Pattern class, then worked through examples demonstrating regex constructs, from basic pattern matching with literal strings to more complex matches using ranges, boundary matchers, and quantifiers.
In Part 2 we’ll pick up where we left off, exploring methods associated with the
PatternSyntaxException classes. You’ll also be introduced to two tools that use regular expressions to simplify … Read the rest
Java’s character and assorted string classes offer low-level support for pattern matching, but that support typically leads to complex code. For simpler and more efficient coding, Java offers the Regex API. This two-part tutorial helps you get started with regular expressions and the Regex API. First we’ll unpack the three powerful classes residing in the
java.util.regex package, then we’ll explore the
Pattern class and its sophisticated pattern-matching constructs.
Get the complete source code for this article’s demo application. Created
… Read the rest
JEP 102: Process API Updates enhances the
java.lang.Process class and introduces the
java.lang.ProcessHandle interface with its nested
Info interface to overcome limitations that often force developers to resort to native code; for example, to obtain the native process ID (PID). This post introduces you to these upgrades.
Enhancing Process, and introducing ProcessHandle and ProcessHandle.Info
Java 9 adds several new methods to the abstract
Process class that let you identify direct child or descendent processes, obtain this
Process‘s PID, return … Read the rest
Understanding type compatibility is fundamental to writing good Java programs, but the interplay of variances between Java language elements can seem highly academic to the uninitiated. This article is for software developers ready to tackle the challenge! Part 1 reveals the covariant and contravariant relationships between simpler elements such as array types and generic types, as well as the special Java language element, the wildcard. Part 2 explores type dependency and variance in common API examples and in lambda expressions.… Read the rest
Java interfaces are different from classes, and it’s important to know how to use their special properties in your programs. This article introduces the difference between classes and interfaces, then guides you through short examples demonstrating how to declare, implement, and extend Java interfaces. I also demonstrate how the interface has evolved in Java 8, with the addition of default and static methods. These additions make interfaces more useful to experienced developers, but they also blur the lines between classes … Read the rest