Use streams to process a list of items to process and output howmany of each item is needed.
publicMap<String,List<String>>createItemMap(Map<String,List<String>> orderMap)
/*OrderID,List of items
eg : 1000 - milk, egg
1002 -milk, bread
1003 -bread, apple
1004 -apple,orange,egg
Result
item, List of orders
milk - 1000,1002
egg - 1000,1004
bread - 1002,1003
apple - 1003,1004
orange - 1004
*/
Use streams to process a list of items to process and output how many of each item is needed. public Map
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am