so this is how my firebase look like:

I want to get to all children of 9-12-2021.
I succeeded to access this node and print the value inside it, but now I'm trying to save all his children's' value in a set but the function first return and then do the inner class of OnDataChange
  FirebaseDatabase.getInstance().getReference().child("Appointment").child(date)
            .addListenerForSingleValueEvent(new ValueEventListener() {
                @Override
                public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                    for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
                        String user = snapshot.getKey();
                        mySet.add(Integer.parseInt(user));
                    }
                }
                @Override
                public void onCancelled(@NonNull DatabaseError error) {
                }
            });
    return times;
how can I use this listener to save all date in the set before he returning from the function? (actually i want to add another function call before the last line )
 
    