I have been given the data for different cars(Year, Model) in the form of Car, consider 2 streams of data coming into my system.
Input Data:
("2018", "i20") ("2018", "zen") ("2016", "alto") ("2015", "k10") ("2014", "ertiga") ("2016", "i20")
What i need to achieve is that when user enters a valid key e.g "2018" as a search keyword, he should be displayed all the associated car models in the sorted order for that key.
e.g in this case output for "2018" should be : [i20, zen]
I am aware that in java hashmap can't have duplicate keys and did some research also that this can be implemented using MultiMap but would really appreciate some leads here.