Merge object from list by comparing one value

Posted by Bala on Stack Overflow See other posts from Stack Overflow or by Bala
Published on 2011-11-11T17:10:19Z Indexed on 2011/11/11 17:52 UTC
Read the original article Hit count: 140

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about java

Related posts about list