Howdy,
first of all, I used the forum'd search function and found a lot of threads dealing with the find() method. I'm sorry if I missed one already answering my question.
In my Bodgitt an Scarper 2.1.1 assignment I have to implement a database
find(String[] criteria) method which supports prefix matching for each array index. The simple implementation would obviously be to iterate the complete database and perform a
String.startsWith() for each record entry.
Obviously, this implementation does not scale very well.
In real life, I would add some kind of
createIndex(int recordFieldIndex) method to my database which creates some sort of suffix tree as a
Trie for instance. However, for the
SCJD, such an implementation seems to be a little out of scope, don't you think?
Has anyone of you spent time on implementing a
find() method which is at least a little smarter than the complete database iteration?
Best regards,
Thomas