Trafigura Interview Question

Implement flatmap with example in java