Java

Enhancements in
Packages java.lang.* and java.util.*

Contents

Enhancements in JDK 5.0

J2SE Development Kit 5.0 has several enhancments in the java.lang.* and java.util.* packages, including:

Enhancements in Java 2 SDK v1.4

Java 2 SDK v1.4 offered several significant enhancements to the functionality in the java.lang.* and java.util.* packages, including

Enhancements in Java 2 SDK 1.3

Version 1.3 of the Java 2 SDK includes the following enhancements:

Classes java.lang.Math and java.lang.StrictMath

The Java 2 Platform now contains two clases which provide API for performing general numeric operations.

New Timer API

Two new classes have been added to the Java 2 Platform to provide an API for a timer facility which can be used for purposes such as animations, human interaction timeouts, on-screen clocks and calendars, work-scheduling routines, reminder facilities, and more.

Countdown.java is a simple demo application that uses the new Timer API.

Enhanced Collections Framework

The Collections Framework has these new convenience APIs:

The following special-purpose implementation has also been added:

Virtual Machine Shutdown Hooks

Sophisticated applications often require the ability to perform specific actions when the virtual machine shuts down, whether due to voluntary exit or involuntary termination. Typical actions include cleanly closing down network connections, saving session state, and deleting temporary files. Every major operating system provides the means for native applications to do this, though of course the details vary from platform to platform. Three methods have been added to java.lang.Runtime to provide a simple and portable interface to these facitilies. The new methods are:

In addition, the Runtime.exit method has been revised. For more information, see Design of the Shutdown Hooks API.

New URL JAR File Caching

The API of classes java.util.zip and java.util.jar have been enhanced with the addition of the following:

The previous implementation of caching downloaded Jar files created problems for long-running server application and for RMI. Each open JarURLConnection creates a temporary local file that holds Jar-file date, and a JarFile object is created on top of the temporary file. Because the open file handle/descriptor on each temporary file was never closed, the files could quickly take up disk space for long-running server applications. The new API provides a solution for this problem by supporting a new "delete-on-close" mode for opening Zip and Jar files.


Copyright © 1999-2004 Sun Microsystems, Inc. All Rights Reserved.


Sun