commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject [Collections][SUBMIT] TypedList
Date Sun, 21 Apr 2002 21:12:33 GMT
After a quick check, I could find no implementation of a type checking list
in collections. As I needed it, I have created one. Here is the class
 * TypedList is a list wrapper that supports type checking. Only elements
 * of the specified type (or a subclass) can be added to the list. An
 * attempt to add a different kind of object, or null, will cause an
 * <tt>IllegalArgumentException</tt>.
 * <p>
 * Constructing a new instance of this class will use an ArrayList behind
 * the scenes. Alternatively, the static <tt>wrap</tt> method can be
 * used to wrap any object implementing List.

The code is attached as a zip. Feedback welcome on whether this is suitable
for inclusion in the collections area.


View raw message