1

I using hashmap but it gives me that message at the android studio

"Contents of collection 'userMap' are updated, but never queried"

my code:

HashMap<String , String> userMap = new HashMap<String , String>();
        userMap.put("username" , name);
        userMap.put("fullname" , fullName);
        userMap.put("country" , country);
congar
  • 229
  • 3
  • 8
  • https://stackoverflow.com/questions/30458975/content-of-collection-never-updated-warning-in-intellij-idea – AskNilesh Aug 17 '18 at 07:54
  • that's not helped me – congar Aug 17 '18 at 07:56
  • 1
    It means that userMap is not returned neither accessed... It's a warning that you are instantiating then initialize the collection but there is no explicit call to it. – dbl Aug 17 '18 at 08:01
  • Can you post the code where you are using contents of the map. Also check if that code is ever executed ( i.e. in case of a method is it invoked or in case of statements in an invoked method then are those statement inside a code block that is executed ) – nits.kk Aug 17 '18 at 08:21
  • updated : you have instansiated the hashmap and have put the entries in it. Queried : Use the hashmap or its contents (map maps key to values, are you using get() or similar API of hashmap) – nits.kk Aug 17 '18 at 08:21

1 Answers1

3

It means that userMap is not returned neither accessed... It's a warning that you are instantiating then initialize the collection but there is no explicit call to it.

Before u make a call to it: enter image description here

After that: enter image description here

dbl
  • 1,109
  • 9
  • 17