Join data from two Lists into one object

Posted by Petr Mensik on Stack Overflow See other posts from Stack Overflow or by Petr Mensik
Published on 2012-10-01T09:36:34Z Indexed on 2012/10/01 9:37 UTC
Read the original article Hit count: 154

Filed under:
|

I ran into following situation and I am wondering about best solution. Let's say I have List<Object1> and List<Object2>, these lists are result of two separated queries. Both of them have the same size and there is relationship 1:1 between elements in the lists based on ID. I know that best solution would be fetching data in one DB query but that's possible right now.

So my question is, what is the best way to join these lists into let's say List<Object3>?

© Stack Overflow or respective owner

Related posts about java

Related posts about list