java - which collection is best to store key value pair but i have to perform search for both key & for value -
i have 2 properties name & phone number.my requirement is, user can search based on property , result should name & phone number.
case 1. if user search based on name,it should name , phone number.
case 2. if user search based on phone number,it should name , phone number..
please tell me,which collection best scenario.
you may use bimap. it's part of guava project.
a bidirectional map, map preserves uniqueness of values of keys. allows inverse view maps each of bimap's values associated key. guava has mutliple implementation types such hashbimap, immutablebimap, enumbimap , enumhashbimap.
you may have @ link.
Comments
Post a Comment