[jdom-interest] Re: NoSuch*Exceptions in JDOM
Joseph Bowbeer
jozart at csi.com
Tue Jun 20 02:30:10 PDT 2000
Dehar Rohit wrote:
>>The thingy coming nearest to getChild() is java.util.Hashtable's
get() method (it returns the value to which the specified key is
mapped in this hashtable). It doesn't throw a No*Exception,
plainly returns a null if the key is not found.<<
I like the reference, and note that this pattern is also repeated
in the newer java.util.Map interface.
NoSuch*Exception is more typical of an iteration, where *not*
throwing an exception would lead to infinite loops.
Note: Both the 'Map' and 'Iterator' interfaces contain
existence-test methods: 'containsKey' and 'hasNext'.
--
Joe Bowbeer
"Sobre los gustos no hay disputa"
(In the matter of taste there is no argument.)
More information about the jdom-interest
mailing list