I am trying to create an object inside the stream but I do not want to define another constructor for the object; I would like to use the setters to put the values where needed. Is this possible?
pe.setExts(pDTO.getExts().stream().map(s->new P(arg1, arg2, ..., arg12)))...; As you can see I have a lot of arguments and some of them requires some processing. I want to avoid doing this processing until it is necessary.
What I am looking for may be something like this (I am not sure how to write the function; I think an anonymous function would be great here):
pe.setExts(pDTO.getExts().stream().map(s->{ P p = new P(); s->setExt1(p.getExt1()); ... List<V> l = p.getExt12(); List<X> finalL = null; [processing list l, populating finalL] s->setExt12(finalL); }));