Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 17614 invoked from network); 6 Mar 2003 20:07:27 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 6 Mar 2003 20:07:27 -0000 Received: (qmail 2674 invoked by uid 97); 6 Mar 2003 20:09:09 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 2667 invoked from network); 6 Mar 2003 20:09:08 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 6 Mar 2003 20:09:08 -0000 Received: (qmail 17364 invoked by uid 500); 6 Mar 2003 20:07:24 -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 17353 invoked from network); 6 Mar 2003 20:07:23 -0000 Received: from f160.law15.hotmail.com (HELO hotmail.com) (64.4.23.160) by daedalus.apache.org with SMTP; 6 Mar 2003 20:07:23 -0000 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 6 Mar 2003 12:07:29 -0800 Received: from 32.97.110.142 by lw15fd.law15.hotmail.msn.com with HTTP; Thu, 06 Mar 2003 20:07:28 GMT X-Originating-IP: [32.97.110.142] From: "David Graham" To: commons-dev@jakarta.apache.org Bcc: Subject: Re: [collections] Desirability of typed and other validatedCollections Date: Thu, 06 Mar 2003 13:07:28 -0700 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 06 Mar 2003 20:07:29.0116 (UTC) FILETIME=[03A509C0:01C2E41C] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N You don't need 1.5 to use generics because you can download the prototype implementation already. This further alleviates any need to duplicate this effort in Jakarta. IMO, all this redundant work just to avoid casting isn't worth it. David >From: grumpoxl >Reply-To: "Jakarta Commons Developers List" > >To: Jakarta Commons Developers List >Subject: Re: [collections] Desirability of typed and other >validatedCollections >Date: 06 Mar 2003 14:45:46 +0000 > > > It seems like a waste of time to write/maintain code that will be >obsolete > > quite soon. I don't find casting collection objects to be terribly >painful > > and 1.5 will provide the function you would be coding. > > > > David > >It is true that Java 1.5 will include generics, and that any typed >Collections that I create will eventually be replaced. However, it >seems to me that Java 1.5 will not be available anytime soon, so any >classes written to solve this problem will not be obsolete for a good >while. > >Even after the release of 1.5, not all developers will have access to >it. The HP-UX production machines at my current job are still running >1.3, due to a kernel upgrade that 1.4 requires. I'm sure that a lot of >developers are in similar situations. > >It seems that the general Jakarta philosophy still leans toward >supporting Java 1.3 at a minimum. So, the question isn't so much about >the possibility of these classes being replaced by better >versions from Sun, but whether or not typed Collections would be a >useful addition to the collections package. I am going to write the >classes either way, I was just wondering if anyone else was interested. > >I wasn't proposing to get rid of the casting involved when retrieving >Objects from Collections, there is no way to do that while implementing >Collection or Map. I was proposing overrides to add(Object), >addAll(Collection), and the Constructors, to add validation to the input >Objects or Collections. Anyone sending or receiving a Collection could >instantly validate whether the content is what they expect, rather than >casting and getting a ClassCastException along the way. I would imagine >that illegal classes would still throw some type of RuntimeException, >perhaps a custom Exception which is more descriptive than ClassCast. > >Anyone else agree/disagree? > > > > >Is there any interest in creating typed Collections? Even though it > > >looks like Java is providing generics with 1.5, this could serve as a > > >good holdover until then, > > > > > >- a TypedCollection(Integer.class) would only allow Integers to its add > > >methods > > > > > >- a TypedMap(String.class, Integer.class) would only allow String keys > > >and Integer values > > > > > >I understand that this type of thing could already by done using > > >Predicates and > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-dev-help@jakarta.apache.org _________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org