The ADS Library (org.devjavasoft.ads and subpackages) is a Java library of algorithms and data structures.

The ADS library provides a set of classes implementing various algorithms and data structures. The library was begun as a pedagogical device to support the teaching of a second course in Java programming by Russel Winder at King's College London, 1997–2001. The goals of that course included ensuring that students knew how to construct and work with complex data structures and algorithms over those data structures and also how to construct and use Java packages. This library started life as a set of small examples shown during lectures.

The library really took form when it was used as a core part of the book Developing Java Software by Russel Winder and Graham Roberts (published by John Wiley & sons; first edition 1997, second edition 2000, third edition 2007). The version of the package that appeared in the first edition had some serious flaws, most of which were eradicated for the second edition and the rest of which have hopefully now been eradicated (but of course we may not have got them all and may have introduced new ones!). This version of ADS uses generics, annotations and all the other features of Java introduced in Java SE 5.0. For various (usability, sales and marketing) reasons, the ADS library has been removed from the book as published, it is now made available as an LGPL project.

There are other libraries that have similar aims and goals to the ADS library. Most notably of course is the Java Collections Framework which is is an integral part of the standard library distributed by Sun Microsystems (Collections is a part of the java.util package) and which provides some algorithms and data structures. The Java Generics Library (JGL), written before the existence of Collections by ObjectSpace (who owned JGL up to version 3) but which is now owned and maintained by Recursion Software (version 4 onwards, see here), aims to provide extensions to Collections that provide a more C++ "STL" style philosophical approach to algorithms and data structures and generic programming using them.

The ADS package has an architecture which is both similar to and different from both Collections and JGL version 3. Moreover, JGL version 3 and Collections have some similarities and also some significant differences. The aim in architecting ADS was to draw on the best of both and lose the worst of both. The ADS approach to code reuse using abstract classes, the general use of inheritance and the approach to thread-safety is like Collections but the ADS approach to iterators is like JGL version 3.

It should be noted that JGL version 3 had a significantly different architecture to JGL version 4 in terms of its management of thread safety and integration with Collections. JGL version 4 is now a fully integrated extension to Collections to provide a different philosophical approach to the standard algorithms and data structures and generic programming using them.

In production applications, Collections (with or without extensions such as JGL) will undoubtedly be used in preference to any library such as ADS since it is distributed with all Java SE and Java EE systems and so is guaranteed to exist on all platforms based on these Java systems. ADS was, is and will remain principally a pedagogical tool since it exposes architecture and design decisions as a learning mechanism that it would be inappropriate to have in a production library – in particular high speed and performance are required of a production library whereas clarity of internal architecture and design is the critical feature of a library designed as a pedagogical tool. Also ADS contains different design variations at the expense of consistency in some places to show different possibilities.


The ADS Library is released under the GNU LGPL.

ADS is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

ADS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with ADS. If not, see http://www.gnu.org/licenses.


Russel Winder
Last modified: 2008-11-28 18:11:00+00:00