if(obj.getAttribute() != null) {
newobject.setAttribute(obj.getAttribute());
}
if(obj.getAttribute() != null) {
newobject.setAttribute(obj.getAttribute());
}
if(obj.getAttribute() != null) {
newobject.setAttribute(obj.getAttribute());
}
Imagine this code at scale - mapping an object with 15+ attributes. How do I reduce cognitive complexity without splitting the mapping in two/three parts which increases the cognitive complexity overall.