Gopinath
Gopinath

Reputation: 5442

How to use Dictionaries in Android like NSMutableDictionary in ios?

I am very new to Android development. I am converting my iPhone app to Android. In my iphone application, I used NSMutableDictionary to store StudentName(Key) and StudentId(Value) from NSXmlParser. Because, each student have different id, each id have different details for the student. If the user search the StudentName using UISearchBar, I want to show the StudentName and also to retrieve the correct Id for that student. I want to do the same in Android app. I searched my level best in Google for this but, I can't find the exact solution for my problem. Can anyone please help to find out the solution?

Thanks in advance.

Upvotes: 0

Views: 2485

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500065

It sounds like you probably want a HashMap... that's certainly a mutable key/value dictionary. It's not clear what you're doing with NSMutableDictionary, but if it's simple key/value lookup, then some implementation of Map (whether it's HashMap or something else) is appropriate.

You might want to read the Java Collections tutorial, too.

Upvotes: 2

Related Questions