I need to create phone book kind of thing. It contains name & number. Now when I type letters matching list should be returned. For the example given below, when I type
Put it all in a MultiMap (or just store a List as the value in your HashMap). For "Brown", store:
"B"->["Brown"]
"BR"->["Brown"]
"BRO"->["Brown"]
If you later add "Bradley":
"B"->["Brown", "Bradley"]
"BR"->["Brown", "Bradley"]
"BRO"->["Brown"]
"BRA"->["Bradley"]
etc...
then have another map to map "Brown" or "Bradley" to the phone number.