Source:
<code>protected void createSubscriptionObjects(Subscription subscription) { if (subscription == null) { throw new IllegalArgumentException("subscription is null"); } Map<String, ProductData> pmap = new HashMap<>(); Map<String, ContentData> cmap = new HashMap<>(); this.addProductsToMap(subscription.getProduct(), pmap); this.addProductsToMap(subscription.getProvidedProducts(), pmap); this.addProductsToMap(subscription.getDerivedProduct(), pmap); this.addProductsToMap(subscription.getDerivedProvidedProducts(), pmap); for (ProductData product : pmap.values()) { this.addContentToMap(product.getProductContent(), cmap); } for (ContentData content : cmap.values()) { if (this.adapter.getContent(content.getId()) != null) { this.adapter.updateContent(content.getId(), content); } else { this.adapter.createContent(content); } } for (ProductData product : pmap.values()) { if (this.adapter.getProduct(product.getId()) != null) { this.adapter.updateProduct(product.getId(), product); } else { this.adapter.createProduct(product); } } if (subscription.getProduct() != null && subscription.getProvidedProducts() != null) { <START> ProductData mktProduct = (ProductData) this.adapter.getProduct(subscription.getProduct().getId()); <END> Set<ProductData> provided = new HashSet<>(); for (ProductInfo providedProduct : subscription.getProvidedProducts()) { provided.add((ProductData) this.adapter.getProduct(providedProduct.getId())); } mktProduct.setProvidedProducts(provided); this.adapter.productMap.put(mktProduct.getId(), mktProduct); } if (subscription.getDerivedProduct() != null && subscription.getDerivedProvidedProducts() != null) { ProductData derivedProduct = (ProductData) this.adapter.getProduct(subscription.getDerivedProduct().getId()); Set<ProductData> provided = new HashSet<>(); for (ProductInfo providedProduct : subscription.getDerivedProvidedProducts()) { provided.add((ProductData) this.adapter.getProduct(providedProduct.getId())); } derivedProduct.setProvidedProducts(provided); this.adapter.productMap.put(derivedProduct.getId(), derivedProduct); } }</code><technical_language>ProductData is a ProductInfo. Also, this feed adapter's map, casting unnecessary</technical_language>

Target:
protected void createSubscriptionObjects(Subscription subscription) { if (subscription == null) { throw new IllegalArgumentException("subscription is null"); } Map<String, ProductData> pmap = new LinkedHashMap<>(); Map<String, ContentData> cmap = new HashMap<>(); if (subscription.getProduct() != null && subscription.getProduct().getProvidedProducts() != null) { this.addProductsToMap(subscription.getProduct().getProvidedProducts(), pmap); } if (subscription.getDerivedProduct() != null && subscription.getDerivedProduct().getProvidedProducts() != null) { this.addProductsToMap(subscription.getDerivedProduct().getProvidedProducts(), pmap); } this.addProductsToMap(subscription.getProduct(), pmap); this.addProductsToMap(subscription.getDerivedProduct(), pmap); for (ProductData product : pmap.values()) { this.addContentToMap(product.getProductContent(), cmap); } for (ContentData content : cmap.values()) { if (this.adapter.getContent(content.getId()) != null) { this.adapter.updateContent(content.getId(), content); } else { this.adapter.createContent(content); } } for (ProductData product : pmap.values()) { if (this.adapter.getProduct(product.getId()) != null) { this.adapter.updateProduct(product.getId(), product); } else { this.adapter.createProduct(product); } } }