How to filter dynamically nested list object java 8
Example:
class Items {
List<Mobile> mobiles;
}
class Mobile{
String mName;
List<Plans> plans;
}
class Plans{
String planId;
String planName;
}
So, I have 3 mobiles (mobiles will be dynamic 3 or 4..etc) with multiple plans on each mobile device. How to dynamically filter common plan for each mobile device ?
Example(P1-planId) :Items:
M1 - P1,P2,P3,P4
M2 - P4,P5,P6,P1,P8,P2
M3 - P7,P2,P4,P1,P8,P9,P10
Result:
Items:
M1 - P1,P2,P4
M2 - P1,P2,P4
M3 - P1,P2,P4