How can I remove the element from the list if some inner list attribute value fails to meet the condition.The trick here is that attribute is itself a list and comparison is based on some attribute of that inner list. Please refer the below sample and help out to fill the comment section in code:
Object :
Class product{
private String productId;
private String productName;
private List<Attribute> attributeList;
public static class Attribute{
private Long attributeId;
}
}
Driver class :
Class Driver{
List<product> productList = new ArrayList<product>();
/*
Remove the object from productList if attributeList doesn't contain attribute with attributeId = x;
*/
}