In criteriaFind(
String criteria) method of Data, I use a SearchCriteriaBuilder class to parse criteria and to store the requested field indexes and the corresponding field values in the Map, and return this Map to criteriaFind(). Subsequently, in criteriaFind() method in Data, for each record in the database, I iterate through the Map to find matching records. This works fine, but I was thinking of the performance issues, since I am getting a new iterator for the Map for every record.
To address the performance issue, I considered using two arrays (one for field indexes, one for values) instead of a Map, such as in code:
This looks much simpler and cleaner than dealing with map and iterators, but the criteria is clearly a map, not two arrays, and I guess I could be penalized for the "two arrays" approach.
How did you guys handle this?
Thanks,
Eugene Kononov.