When using Firebase 2.4 ref.updateChildren()
with HashMap, other than HashMap
(e.g. HashMap
)
As in the code snippet from the Official Firebase Blog to avoid this issue one has to re-write custom structure like this:
Map newPost = new HashMap();
newPost.put("title", "New Post");
newPost.put("content", "Here is my new post!");
And then put it instead of custom data model:
Map updatedUserData = new HashMap();
updatedUserData.put("users/posts/" + newPostKey, true);
updatedUserData.put("posts/" + newPostKey, newPost);
Using custom data model instead of newPost
causes IllegalStateException.