小编Ani*_*oun的帖子

java.lang.Long 无法转换为 java.lang.Integer

map我想从数据库(Firebase)读取地图,并将其与另一个地图进行比较motcle,如果我找到重复的键,我会增加该键的值map,我遇到了 ClassCastException。\n代码:

\n\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)

java collections firebase

5
推荐指数
1
解决办法
7640
查看次数

标签 统计

collections ×1

firebase ×1

java ×1