I want to read an input string , check whether it ends with a given list of values present in key part of the a property file say sample.properties given below and replace it with values :
(i.e: suppose input string ends with either COM or C.OM or COM. or COM, i want to replace it with COM)
sample.properties
ABC=COM
BCD=COM
EFG=COM
HIJ=COM
KLM=CO
XYZ=CO
Note that i have around 4000 entries in the property file.
My plan is to :
1) load the key and values in a HashMap during loading of application.
2) look if the input String ends with any word contained in the "key" part of the property file. This would be done by taking the keySet of the HashMap.
Is it feasible , if, for every incoming input value, i check whether the input value ends with any value contained in the keySet of the Hashmap?
Or are there any other better way of doing it?