Explanation -
DatabaseReference Ref;
//intialize Ref variable
Ref = FirebaseDatabase.getInstance().getReference(); //root reference
after this, adding the valueEventListener to Ref
Ref.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.hasChild("abcd")) {
//abcd child is present
}else {
//abcd child is not present
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
Now Specifically my question is which algorithm does the firebase using behind the dataSnapshot.hasChild("abcd")
?
In Firebase-database if my root reference contains a huge number of childs then this is an efficient method to use or not?