In the event of an invalid field name being provided as part of the criteria the behavior of this method is the same as if no records matched correctly specified criteria.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Have you considered using a Map instead of your two lists?
Have you considered using StringTokenizer instead of the substring()/indexof()
I had thought to put the indexes and the values into a map, but when I go through all the records and do the comparing, I don't know how to take them out from the map one by one without knowing what is in the map.
Do you think this method is to big, and I should divide it into several little methods?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
it is too easy for someone reading your code to be confused.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Your findByCriteria method works on an array of activeRecords. However there is nothing to stop additional records being added, or existing records being deleted while you are inside this method. Is this OK for you? Are you commenting this?
As with my comment to Damu - why are you iterating through the returnList to put the items it contains into an array, when the toArray() method will do this for you?
But if the records are deleted, after collecting list of active records, while reading the record with record number, it will throw RNF exception.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Originally posted by Andrew Monkhouse:
In you match() method - nice use of &= (last time I did that, my team spent 15 minutes reviewing 200 lines of code, and 45 minutes reviewing my use of &= ) but I wonder if it is worthwhile?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Regular expression will make the code simple.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
The only difference is that you are now using double quotes instead of single quotes. This solves the issue I raised: Your regex will fail if either the column name or the criteria to match contains a single quote (e.g. "O'briensContractors") - does this concern you?
1. Has anyone used StringTokenizer to parse the criteria String instead of the java.util.regx package and passed the exam without losing points on criteriaFind method implementation ?
2. I have both the "Origin City" and "Destination City" as input TextFields, has anyone implemented them this way and passed without being penalized, or do I have to implement a ComboBox with a selection of cities for these two input fields ?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|