The java.util Subpackages
Java defines the following subpackages of java.util:
Each is briefly examined here.
java.util.concurrent, java.util.concurrent.atomic, and java.util.concurrent.locks
The java.util.concurrent package along with its two subpackages, java.util.concurrent.atomic and java.util.concurrent.locks, support concurrent programming. These packages provide a high-performance alternative to using Java’s built-in synchronization features when thread-safe operation is required. Beginning with JDK 7, java.util.concurrent also provides the Fork/Join Framework. These packages are examined in detail in Chapter 28.
The java.util.function package defines several predefined functional interfaces that you can use when creating lambda expressions or method references. They are also widely used throughout the Java API. The functional interfaces defined by java.util.function are shown in Table 19-19 along with a synopsis of their abstract methods. Be aware that some of these interfaces also define default or static methods that supply additional functionality. You will want to explore them fully on your own. (For a discussion of the use of functional interfaces, see Chapter 15.)
The java.util.jar package provides the ability to read and write Java Archive (JAR) files.
The java.util.logging package provides support for program activity logs, which can be used to record program actions, and to help find and debug problems.
The java.util.prefs package provides support for user preferences. It is typically used to support program configuration.
The java.util.regex package provides support for regular expression handling. It is described in detail in Chapter 30.
The java.util.spi package provides support for service providers.
The java.util.stream package contains Java’s stream API, which was added by JDK 8. A discussion of the stream API is found in Chapter 29.
The java.util.zip package provides the ability to read and write files in the popular ZIP and GZIP formats. Both ZIP and GZIP input and output streams are available.