Initialize new object and set values with Java 8 -


right passing to following way, creating object first, calling methods set values, passing object method.

to = new to(); to.setemail("emailaddress@gmail.com"); to.setname("john smith");  headers headers = new headers(); headers.setto(arrays.aslist(to)); 

is possible doing above related to object while calling headers.setto?

headers headers = new headers(); headers.setto(is possible initialize , set "to" values in here?); 

not pojo approach. either create constructor in having fields need parameters or go builder pattern.


Comments