This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a question on implementing find(), here is my assignment spec on find():
A null value in criteria[n] matches any field value. A non-null value in criteria[n] matches any field value that begins with criteria[n]. (For example, "Fred" matches "Fred" or "Freddy".) public int  find(String  criteria)
If so, it is not possible to locate contractors with matching specialty but not at the beginning of its record value. For example, say, a contractor has specialty string in its record as:"Roofing, Carpeting", and user is searching for "Carpeting". According to spec of find(), this is not a match becaues the contractor's specialty does not begin with "Carpeting".
Is that the way we suppose to return results to UI, i.e., only contractors with matching specialty at its very beginning is returned?
In addition, this implements a case-sensitive search, but I assume that is what the spec. wants us to do.
Hi, Yan. I was wondering if the list of specialties was standartized, i.e., comma-separated as a rule. Then, you could search for all specialties by separating the specialties String by comma.
Anton Golovin (email@example.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Joined: Sep 02, 2003
I know how to implement it.
But I am just wondering if "Roofing, Carpeting" is considered as a match for "Carpeting", does not that violate the spec. of find(), which it specifically says "the beginning...."?
Joined: Jul 02, 2004
I am sure in this case they mean the beginning of a specialty name, not the list of specialties - so you should be ok to implement it. When I was working on my project, I found it helpful to account for items I had doubts about in the choices.txt; I made some choices when the requirement was ambiguously worded - and the project passed. [ November 11, 2004: Message edited by: Anton Golovin ]