HashSet<String> timeSet = new HashSet<>();
MainActivity.dbreference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull @NotNull DataSnapshot snapshot) {
for (DataSnapshot s : snapshot.child("users").child(MainActivity
.currentUser.getUid()).child("timetable").getChildren())
{
timeSet.add(s.getKey());
}
}
@Override
public void onCancelled(@NonNull @NotNull DatabaseError error) {}});
Log.d(TAG, timeSet.toString());
This code was supposed to added to timeSet all keys, which are in this path (they are there), but output to log was showed, what set is empty
Why?