0
votes

I'm a newbie to project reactor. I have a question, How to add a Mono to a Mono<List>?(I know I can use Mono.block method to get String from Mono, but I want to learn the correct reactive way, so Mono.block is not accepted.)

import java.util.ArrayList;
import java.util.List;
import reactor.core.publisher.Mono;

public class Classroom {

    private Mono<List<String>> classroom = Mono.just(new ArrayList<String>());
    
    public void addStudent(Mono<String> student) {
        //add the Mono<String> student to Mono<List<String>> classroom
    }
}