Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 56167 invoked from network); 14 Sep 2002 01:39:52 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 14 Sep 2002 01:39:51 -0000 Received: (qmail 476 invoked by uid 97); 14 Sep 2002 01:40:34 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 458 invoked by uid 97); 14 Sep 2002 01:40:33 -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 446 invoked by uid 98); 14 Sep 2002 01:40:33 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 content-class: urn:content-classes:message Subject: RE: [Collections] Array Stack throws NPE on push() but not add() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 13 Sep 2002 18:39:55 -0700 Message-ID: <458473676F1AC74A84EAB2F22004DA6D5311EA@mail.nextance.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [Collections] Array Stack throws NPE on push() but not add() Thread-Index: AcJbiiNobcutNi2xQ6q3Be3Xx/M+xQABWF+w From: "Scott Sanders" To: "Jakarta Commons Developers List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I will commit the change then next week, unless there is a dissenting opinion. Scott > -----Original Message----- > From: Steve Downey [mailto:steve.downey@netfolio.com]=20 > Sent: Friday, September 13, 2002 5:59 PM > To: Jakarta Commons Developers List > Subject: Re: [Collections] Array Stack throws NPE on push()=20 > but not add() >=20 >=20 > I can't see any reason for it to throw an exception. In fact,=20 > it even has a=20 > specific check for =3D=3D null, and throws the exception specifically. >=20 > In general collections should only throw a null pointer=20 > exception when it has=20 > to. And then as a side effect of calling a method on a null object. >=20 > On Friday 13 September 2002 08:20 pm, Scott Sanders wrote: > > I am trying to use ArrayStack as a sort of sparse stack=20 > (most elements=20 > > are null), and noticed that push guards against null, whereas add()=20 > > does not. For example: > > > > 1. stack.push(null) throws NPE > > 2. stack.add(null) works fine > > > > Which one is incorrect? I believe that these should be=20 > symmetric, but=20 > > which way? I actually don't want to guard against null in=20 > either. If=20 > > the decision is for guarding, do I just extend and override=20 > or does it=20 > > have a place in collections? > > > > Cheers, > > Scott Sanders > > > > Perfection is achieved, not when there is nothing more to add, but=20 > > when there is nothing left to take away. - Antoine de Saint-Exupery >=20 >=20 > -- > To unsubscribe, e-mail: =20 > unsubscribe@jakarta.apache.org> > For=20 > additional commands,=20 > e-mail: >=20 >=20 -- To unsubscribe, e-mail: For additional commands, e-mail: