When using Firebase 2.4 ref.updateChildren()
with HashMap, other than HashMap
(e.g. HashMap
)
On your last question:
Is there a way to pass custom HashMap like HashMap to ref.updateChildren() ?
The Firebase SDK for Android/Java doesn't support directly passing POJOs (like your User
class) into updateChildren()
.
But what you can do is convert the POJO into a Map
with:
Map userMap = new ObjectMapper().convertValue(user, Map.class);
Then you can put the map of values into the values that you're passing into updateChildren()
:
updates.put("users/"+uid, userMap);
updates.put("lists/"+uid+"/mine, "value");
ref.updateChildren(updates);