I have a ArrayList of object as below:
Object:
String country;
String languages;
String number;
The list is as below:
India, Hindi, 500
India, English, 600
India, Bengali, 800
US, French, 700
Germany, German, 800
Above list is present in my code as:
List<MyObject> myList; // this is the list I want to query
So there are 5 MyObject objects in the myList with values as mentioned before.
language and country properties of the object makes a unique key in my case.
So I want to fetch the corresponding number based on the language and country.
e.g. something like:
getNumber(India, Hindi) should return 500
getNumber(India, Bengali) should return 800
How to query the list in this manner ? Is it possible through Iterator ?
Thanks for reading.