map我想从数据库(Firebase)读取地图,并将其与另一个地图进行比较motcle,如果我找到重复的键,我会增加该键的值map,我遇到了 ClassCastException。\n代码:
public void addMotcle(final Map motcle, String Userid)\n{\n mDatabase = FirebaseDatabase.getInstance().getReference("User");\n DatabaseReference user = mDatabase.child(Userid);\n final DatabaseReference keylist = user.child("motcle");\n keylist.addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(DataSnapshot dataSnapshot) {\n if(dataSnapshot.exists())\n { \n //I tried to put the map in another map and change it but \n //It is still the same error\n Map<String,Integer> map = (Map) dataSnapshot.getValue();\n Map<String,Integer>Hmap= new HashMap<>();\n Hmap.putAll(map);\n //if there is duplicate we incremente les mots cl\xc3\xa9\n for (Object key …Run Code Online (Sandbox Code Playgroud)