Rajat Diwate :
1.I am getting a List of Objects form Database Containing Fields as per my pojo.. List fieldList==>Contains the List of Objects...>
List<Object> fieldList;
for(Object abc: fieldList){
abc.setIdMongoStr("RoleName");
abc.setTenantRegion("RoleNumber");
}
How do i convert it Stream ????
Constantin Trepadus :
if you need to set the same value to each item and thats all, you can use directly foreach, here is an example:
fieldList.stream().forEach(field -> {
field.setIdMongoStr("RoleName");
field.setTenantRegion("RoleNumber");
});
This will mutate directly your objects inside the list