 | Level: Intermediate Andrew Glover (ajglover@gmail.com), Author and developer
16 Dec 2008 Write less code by leveraging a battle-hardened collection of open source utilities from the Apache Commons project's Lang library. Reusing other people's reliable code helps you get your software to market more quickly, with fewer defects.
In this tutorial
Commons Lang is a component of Apache Commons, a macro project whose many subprojects relate to various aspects of software development in the Java™ language. Commons Lang extends the standard java.lang API with string-manipulation methods, basic numerical methods, object reflection, creation and serialization, and System properties. It also contains an inheritable enum type, support for multiple types of nested Exceptions, enhancements to java.util.Date, and utilities that help with building methods such as hashCode, toString, and equals. I've found Commons Lang to be helpful across a wide variety of application verticals. By using Commons Lang, you'll end up writing less code, which lets you deliver production-ready software faster and with fewer defects. This tutorial guides you step-by-step through the fundamental concepts of using a few different Commons Lang classes and leveraging their code so that you don't have to write so much of it yourself.
Objectives - Implement object contracts such as equals and hashCode.
- Verify their proper functionality.
- Implement the Comparable interface's compareTo method.
Prerequisites
To get the most from this tutorial, you should be familiar with Java syntax and the basic concepts of object-oriented development on the Java platform. You should be familiar with refactoring and normal unit testing as well.
System requirements
To follow along and try out the code for this tutorial, you need: The recommended system configuration for this tutorial is:
- A system supporting either the Sun JDK 1.5.0_09 (or later) or the IBM JDK 1.5.0 SR3
with at least 500MB of main memory.
- At least 20MB of disk space to install the software components and examples covered.
The instructions and examples in the tutorial are based on a Microsoft® Windows® operating system. All the tools covered in the tutorial also work on Linux® and UNIX® systems.
Duration
1 hour
Formats html, pdf
|  | |  |