There will be list having below elements as origin and destination.
origin | destination
AA | 01
AB | 02
AC | 03
AD | 04
If a user provide input as 04 then the out put should be AD. I was said to use getters and setters for this
As list would not have key value pair, i thought that i would take two lists. One for origin and one for destination.
As per my code, 04 is in 3rd position of destination list. Hence, I retrieved the third element from origin list. If i add new object after the third element still my program works. If i add before third element, the output would be different for sure.
My code for the program is as below.
Please let me know if i could do this program in different way to make it generalize