java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map -


am new java .getjsonvalue method returns array [men,women] , [dog,cat] while executing above code getting:

java.lang.classcastexception: java.util.arraylist cannot cast java.util.map

  private map<string, list<string>> devcap = new hashmap <string, list<string>>();      public <t>t getjsonvalue(response res, string path ){            string json = res.asstring();            jsonpath jpath = new jsonpath(json);            return jpath.get(path);      }         devcap = helper.getjsonvalue(response, "results.devices.cap");      try {            (map.entry<string, list<string>> entry : devcap.entryset()) {             string key = entry.getkey();             list<string> values = entry.getvalue();             system.out.println("key = " + key);             system.out.println("values = " + values + "n");        } 

how rid of error


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -