I am looking for help where I'm trying to iterate product having order list(OrderItem) which also contains sub-OrderList(OrderItem) and the same also contains structure inside it (n times).
How to iterate recursively all the orders and search for action having completed and added all the completed Order in the list?
I have done through BFS/DFS but looking for best optimized solution using functional programming in java. TIA.
Main Product
Class ProductOrder
{
private List<OrderItem> orderItem = new ArrayList<OrderItem>();
}
Sub items in product
Also have n sub-items inside it
Class OrderItem{
private String id;
private String state;
private Integer quantity;
private List<OrderItem> orderItem = new ArrayList<OrderItem>();
}