[jdom-interest] [Vote] NoSuchChildException
Alex Chaffee
guru at edamame.stinky.com
Thu Jul 13 04:16:42 PDT 2000
> Oh, wait, no, it only makes sense
> because in this case (getFirst() and getLast()) "null" has a different
> meaning. It means "the first item in the list is null", not "there is
> no first item since the list is empty."
That also justifies its use in Iterator. Since a collection may
contain null entries, you need an out-of-band way to signify "end of
list" as separate from "entry is null." You will note that the
API-prescribed way to signify that is the hasNext() method. The
exception is only thrown in the *exceptional* case that the programmer
ignored the result of hasNext(). (Which is a RuntimeException since
the programmer messed up.)
Kid Tested, Mother Approved -
- Alex
--
Alex Chaffee mailto:alex at jguru.com
jGuru - Java News and FAQs http://www.jguru.com/alex/
Creator of Gamelan http://www.gamelan.com/
Founder of Purple Technology http://www.purpletech.com/
Curator of Stinky Art Collective http://www.stinky.com/
More information about the jdom-interest
mailing list