Re: hashtable - select by wilecard... is it doable?



tak wrote:
Hi,

What is a data structure out there, that you can select by wilecard,
and also have fast retrievals?

like, if i have 4 keys, JOHN, JONATHAN, JOAN, TOM., and I want to do a
getKey by, "JO*", and that would return the values for the one that
matches JO* as either array, set, collection..etc...

thanks,
T


If you are only concerned about matching the first few characters (starts with JO) then would a TreeSet<String> (that I refer to a treeSet below) work?

SortedSet<String> tailSet = treeSet.tailSet("JO");
TreeSet<String> matchingSet = new TreeSet<String>();
for (String s : tailSet) {
if (!s.startsWith("JO")) {
break;
}
matchingSet.add(s);
}
return matchingSet;

Just and idea and not sure if it is what you need.

Cheers,

Dan Andrews
- - - - - - - - - - - - - - - - - - - - - - - - -
Ansir Development Limited http://www.ansir.ca
- - - - - - - - - - - - - - - - - - - - - - - - -
.



Relevant Pages

  • Re: BETWEEN . . . AND Operator
    ... John, create a table where you can enter the value and matching text. ... You can tweak the values or add ranges just by updating the table, and everywhere in the software behaves consistently. ...
    (microsoft.public.access.forms)
  • Re: hashtable - select by wilecard... is it doable?
    ... What is a data structure out there, that you can select by wilecard, ... and also have fast retrievals? ... If you are only concerned about matching the first few characters ...
    (comp.lang.java.programmer)
  • Re: Compare Datasets or Arrays
    ... It was called "matching" in that cardpunch concept. ... It is doing going foreward in the arrays by matching everytime the keys of ... it assumes that both arrays are sorted on the key value. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: hashtable - select by wilecard... is it doable?
    ... What is a data structure out there, that you can select by wilecard, ... and also have fast retrievals? ... If you are only concerned about matching the first few characters ...
    (comp.lang.java.programmer)
  • Re: Why isnt the whitespace removed?
    ... I'm working on my own variant of grep and I have an annoying ... >> the next line the complete matching line. ... >> leading whitespace when outputting the matching line so I am using ... Thanks John. ...
    (comp.lang.cpp)