Skip to content Skip to sidebar Skip to footer

How To Use The Hashmap In Datamodel

I am newbie to Android and I am working in an Android project. I want to implement a data model, using that model I want to perform the arithmetic operations using the Hash Map. Bu

Solution 1:

For my understanding you want to know how to populate HashMaps. So first of all you should read this documentation: https://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html

Code:

Map<String, String> map = newHashMap<>();

// Add things to the map
map.put("key","value");

// Get values from mapString value = map.get("key");

In very generic terms with this you can start doing stuff :) but you should absolutely read the documentation and have a deep understanding regarding how a Map works and then decide which type of Map you need to fulfil your requirements.

Post a Comment for "How To Use The Hashmap In Datamodel"