Source:
public static boolean isChangedBy(Product entity, ProductDTO dto) { if (dto.getId() != null && !dto.getId().equals(entity.getId())) { return true; } if (dto.getName() != null && !dto.getName().equals(entity.getName())) { return true; } if (dto.getMultiplier() != null && !dto.getMultiplier().equals(entity.getMultiplier())) { return true; } Collection<String> dependentProductIds = dto.getDependentProductIds(); if (dependentProductIds != null && !Util.collectionsAreEqual(entity.getDependentProductIds(), dependentProductIds)) { return true; } Map<String, String> attributes = null; if (dto.getAttributes() != null) { attributes = dto.getAttributes().getAttributes(); } if (attributes != null && !attributes.equals(entity.getAttributes())) { return true; } Set<ProductContentDTO> productContent = dto.getProductContent(); if (productContent != null) { Comparator comparator = (lhs, rhs) -> { ProductContent existing = (ProductContent) lhs; ProductContentDTO update = (ProductContentDTO) rhs; if (existing != null && update != null) { Content content = existing.getContent(); ContentDTO cdto = update.getContent(); if (content != null && cdto != null) { if (cdto.getUuid() != null ? cdto.getUuid().equals(content.getUuid()) : (cdto.getId() != null && cdto.getId().equals(content.getId()))) { return (update.getEnabled() != null && !update.getEnabled().equals(existing.isEnabled())) || ContentManager.isChangedBy(content, cdto) ? 1 : 0; } } } return 1; }; if (!Util.collectionsAreEqual((Collection) entity.getProductContent(), (Collection) dto.getProductContent(), comparator)) { return true; } } Collection<BrandingInfo> brandingDTOs = getBranding(dto); if (brandingDTOs != null) { Comparator<BrandingInfo> comparator = BrandingInfo.getBrandingInfoComparator(); if (!Util.collectionsAreEqual((Collection) entity.getBranding(), (Collection) brandingDTOs, comparator)) { return true; } } return false; }

Target:
public static boolean isChangedBy(Product entity, ProductDTO dto) { if (dto.getId() != null && !dto.getId().equals(entity.getId())) { return true; } if (dto.getName() != null && !dto.getName().equals(entity.getName())) { return true; } if (dto.getMultiplier() != null && !dto.getMultiplier().equals(entity.getMultiplier())) { return true; } Collection<String> dependentProductIds = dto.getDependentProductIds(); if (dependentProductIds != null && !Util.collectionsAreEqual(entity.getDependentProductIds(), dependentProductIds)) { return true; } Map<String, String> attributes = null; if (dto.getAttributes() != null) { attributes = Util.toMap(dto.getAttributes()); } if (attributes != null && !attributes.equals(entity.getAttributes())) { return true; } Collection<ProductContentDTO> productContent = dto.getProductContent(); if (productContent != null) { Comparator comparator = (lhs, rhs) -> { ProductContent existing = (ProductContent) lhs; ProductContentDTO update = (ProductContentDTO) rhs; if (existing != null && update != null) { Content content = existing.getContent(); ContentDTO cdto = update.getContent(); if (content != null && cdto != null) { if (cdto.getUuid() != null ? cdto.getUuid().equals(content.getUuid()) : (cdto.getId() != null && cdto.getId().equals(content.getId()))) { return (update.getEnabled() != null && !update.getEnabled().equals(existing.isEnabled())) || ContentManager.isChangedBy(content, cdto) ? 1 : 0; } } } return 1; }; if (!Util.collectionsAreEqual((Collection) entity.getProductContent(), (Collection) productContent, comparator)) { return true; } } Collection<BrandingDTO> brandingDTOs = dto.getBranding(); if (brandingDTOs != null) { Comparator comparator = getBrandingDTOComparator(); if (!Util.collectionsAreEqual((Collection) entity.getBranding(), (Collection) brandingDTOs, comparator)) { return true; } } return false; }