Merge object from list by comparing one value
- by Bala
I have two List of Objects (one is master list and other is error list) and if there is a match of one value when compared two lists then merge all other error list values into mast list value (only one object). Other than iterating is there any other way to compare a value and then merge that object.
Object is a Value object with some setters and getters.
Appreciate your help.
List<OrderVO> masterList;
List<OrderVO> errorList;
If errorList.OrderVO.getOrderID = masterList.OrderVO.getOrderID then
masterList.OrderVO.merge(errorList.OrderVO) or copy all values of masterList.OrderVO.copy(errorList.OrderVO).
Hoper this is clear