I have 2 POJO Foo and FooDBObj, I fetch List of FooDBObj from database and now I need to create List of Foo Objects. I need to set Id and name in FooDBObj into Foo's BarId and BarName respectively. If its in Java Stream it will be better
I have tried to get the list of Id's alone from below code.
List<String> fooIds =FooDBObjList.stream().map(FooDBObj::getId).collect(Collectors.toList());
The above code can give me only list of Id for Foo I need all the FooDBObj.id to be set in Foo.BarId and FooDBObj.name to be set in FooDBObj.BarName