Search code examples
androidkeymapping

How to use Dictionary (like iphone NSDictionary) in android?


I have worked in soap message, and to parse the value from Webservice, the values are stored in ArrayList.

Example: values are Employee name (Siva) and Employee id (3433fd), these two values are stored in arraylist, but I want to stored in Dictionary, How?


Solution

  • you can use HashMap like this

    Map <String,String> map =  new HashMap<String,String>();
    //add items 
    map.put("3433fd","Siva");
    //get items 
    
    String employeeName =(String) map.get("3433fd");