commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Sanders" <ssand...@nextance.com>
Subject [Collections] Array Stack throws NPE on push() but not add()
Date Sat, 14 Sep 2002 00:20:14 GMT
I am trying to use ArrayStack as a sort of sparse stack (most elements
are null), and noticed that push guards against null, whereas add() 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 symmetric, but
which way? I actually don't want to guard against null in either.  If
the decision is for guarding, do I just extend and override or does it
have a place in collections?

Cheers,
Scott Sanders 

Perfection is achieved, not when there is nothing more to add, but when
there is nothing left to take away. - Antoine de Saint-Exupery


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message