public class ClassOne {
private Long id;
private List<ClassTwo> secondClass;
}
public class ClassTwo {
private Long link;
private ClassThree thirdClass;
}
public class ClassThree {
private Long number;
}
Datas available :
List<classOne> classOneList
List<Long> referencedNumbers
Requirements :
To iterate the classOneList and store the values in Map<Long, <ListLong>> by having id from ClassOne as 'key' and link from ClassTwo as 'values' only if referencedNumbers contains a number from ClassThree.
Note : It should be implement only using streams rather than loops and restricted to Java 8
- Return type should be:
Map<Long, List<Long>> - For more Clarity:
Map<id, List<link>>
Please let me know for any more clarifications