I have two cards, namely
Map<String, Set<String>> courseTeacherMap = {course1: [teacher1, teacher2], ...} Map<String, Set<String>> teacherStudentMap = {teacher1: [student1, student2], ...}
And I defined a courseStudentPair class that has a very simple structure
public class courseStudentPair{ String studentName;
And my goal is to deduce Set<courseStudentPair> from two maps. While teacher A teaches course C, every student who is in the set of key A values ββin teacherStudentMap is considered a student taking C.
For example, given
Map<String, Set<String>> courseTeacherMap = {c1: [t1], c2:[t2], c3:[t1, t2]} Map<String, Set<String>> teacherStudentMap = {t1: [s1], t2:[s1, s2]}
The result should be * (student, course) means the courseStudentPair object in the example below *
Set<courseStudentPair> result = [(c1, s1), (c2, s1), (c2, s2), (c3, s1), (c3, s2)]
This is pretty easy to do for loops, but I'm learning the flow function in Java 8, and it seems pretty complicated to me. You can assume that the courseStudentPair class has a constructor or constructor.