2) Not using the word 'ANY' , but the implementation implicitly uses this.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Aadhi
6 - Declarations
6.1 Number Per Line
One declaration per line is recommended since it encourages commenting. In other words,
int level; // indentation level
int size; // size of table
is preferred over
int level, size;
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
How does this handle an invalid field name?
Andrew: How does this handle an invalid field name?
Rajesh: If an invalid field name is given, it will be filtered in the parse method and will not be searched for. Hence the result will be empty.
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Can you please confirm that your code does work?
You said: Your suggestions regarding my having a list of ALL records and subtracting the NONMatching records would be very useful
I am wondering why you are doing it this way. I would have thought it easier just to track the matching records.
I think you should reconsider some of your variable names to make it easier to read your code. For example:
Map result = parse(criteria);
to me, result is something you are sending back to the calling method, not an internal variable name. Perhaps criteriaMap would be more meaningful?
I didnt see that in your parse method - it appeared to throw the exception, then continue with the next criteria, which would mean the bad field name is just ignored.
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
Carrier='SpeedyAir',Origin airport='any'
Carrier='SpeedyAir',Origin airport='any' Date="20030512"
But what about the criteria: Carrier='SpeedyAir',Origin airport='any' Date="20030512"? You will discard the Origin Airport field and the Date field from the fields to match on wont you? Your parse method will return back the same map as before. Or am I wrong?
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.
So for my instructions, the second search above should return zero records - do you have different instructions?
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
This will take every ounce of my mental strength! All for a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|