I have to choose one data structure for my need below i am explaining the conditions there are following values
abc,def,rty,ytr,dft which all are map to row R1B1 (actully key is combination of R1+B1) abEERc,dFFFef,rGGty which all are map to row R1B1 (actully key is combination of R1+B2)
KEY VALUE
abc,def,rty,ytr,dft ---> R1B1
abEERc,dFFFef,rGGty ---> R1B2
now for example lets say if i get ytr then i would be able to retrieve R1B1 or lets say i get the value rGGty then i would be able to retrieve R1B2 now the case is that matters is of search , complexity and the time taken as the things have to go in sequence
for example it will first pick the first line to search ytr , it will first match it with abc which will not match then will have to match with def it will not again match then it will match with rty which will not also match then it will finally match with ytr and finally it will find the key R1B1 finally
similarly if the second string need to be searched lets say rGGty then it would scan first row in which it will not find the value then search would continue to second row and also in second row in the third element it would get rGGty as element then it would retrieve R1B2 as value
lets say if put this thing in map then a sequence search will go on key and then only we will be able to find the corresponding value ,
Folks please advise which will be the best data structure i can implement in java in which i will have to search the keys items to find the corresponding value in very fast time also which will not hit the performance too
Folks please advise which will be the best data structure to obtain this functionality itself