i think when there are no record to return , the best is to return an array of int value with zero size rather than null , becuase the caller for this method expect any array and he will loop on this array , if the array have no element so the loop will not enter , but when the find method return null , may be the caller will throw NullPointerException if the caller don't know that this method will return null if the records not found or record don't match .
Originally posted by Simon O'Brien:
Great, that is what I was thinking, I just needed clarification! Thanks for all your help.
Originally posted by Alex Belisle Turcot:
I agree with you Mark, which is why I choose to throw RecordNotFound from my find method...
Do you throw "DuplicateKeyException" in your create method ? (its a dilemma if you use recNo as your key which easily leads to the impossibility of having a duplicate key.. (ex: key = maxRecNo + 1).
I don't know if I should still add the code to throw DuplicateKeyException and insert a comment stating that "it is currently not possible to meet this condition, but it is kept in order to support future modifications..."
Do you understand my point ? What's your opinion on that ?
Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton