Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 35929 invoked from network); 23 Apr 2002 15:48:31 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 23 Apr 2002 15:48:31 -0000 Received: (qmail 24431 invoked by uid 97); 23 Apr 2002 15:48:32 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 24415 invoked by uid 97); 23 Apr 2002 15:48:31 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 24404 invoked from network); 23 Apr 2002 15:48:31 -0000 Message-ID: <0c6201c1eadd$7c508bd0$9865fea9@spiritsoft.com> From: "James Strachan" To: "Jakarta Commons Developers List" References: Subject: Re: [Collections][SUBMIT] TypedList Date: Tue, 23 Apr 2002 16:42:32 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N +1 this seems a good idea. James ----- Original Message ----- From: "Jack, Paul" To: "'Jakarta Commons Developers List'" Sent: Tuesday, April 23, 2002 4:14 PM Subject: RE: [Collections][SUBMIT] TypedList > Hi Steve, > > Your TypedList got me thinking...At first I thought, wouldn't > it be nice to specify a parameter that would allow the null > element (sometimes I need a list that allows nulls)...then I > got to thinking, actually wouldn't it be nice if the validate() > method could be overridden by a subclass to allow more than one > class type...then I thought, actually, wouldn't it be nice if > the validation were completely generic, so that you supplied the > validation routine in the constructor of the list...then I > realized, the collections package already defines an interface > for validations (Predicate)... > > So...do you think it's a good idea to alter TypedList so that it > takes a Predicate in its constructor? You could then supply a > concrete Predicate that does the Class.isInstance check... > > -Paul > > -----Original Message----- > From: Stephen Colebourne [mailto:scolebourne@eurobell.co.uk] > Sent: Sunday, April 21, 2002 2:13 PM > To: Jakarta Commons Developers List > Subject: [Collections][SUBMIT] TypedList > > > Hi, > 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 > javadoc: > * 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 > * IllegalArgumentException. > *

> * Constructing a new instance of this class will use an ArrayList behind > * the scenes. Alternatively, the static wrap 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. > > Stephen > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: