Firebase数据库快速启动处理计数的方式安全吗?
if (p.stars.containsKey(getUid())) { // Unstar the post and remove self from stars p.starCount = p.starCount - 1; p.stars.remove(getUid());} else { // Star the post and add self to stars p.starCount = p.starCount + 1; p.stars.put(getUid(), true);}
p.stars = new HashMap<>();
相关分类