Source:
<code>public void testCheckin1_ExistingContentWithChildAndParentRels_NullRels_ShouldKeepExistingRels() throws DotDataException, DotSecurityException { Contentlet blogContent = null; List<Contentlet> relatedContent = null; try { blogContent = getBlogContent(); final ContentletRelationships relationships = getACoupleOfParentAndChildrenSelfJoinRelationships(blogContent); final Relationship relationship = relationships.getRelationshipsRecords().get(0).getRelationship(); relatedContent = relationships.getRelationshipsRecords().get(0).getRecords(); final List<Category> categories = getACoupleOfCategories(); blogContent = contentletAPI.checkin(blogContent, relationships, categories, null, user, false); contentletAPI.isInodeIndexed(blogContent.getInode()); List<Contentlet> relatedContentFromDB = relationshipAPI.dbRelatedContent(relationship, blogContent); assertTrue(relatedContentFromDB.containsAll(relatedContent)); Contentlet checkedoutBlogContent = contentletAPI.checkout(blogContent.getInode(), user, false); Contentlet reCheckedinContent = contentletAPI.checkin(checkedoutBlogContent, (ContentletRelationships) null, null, null, user, false); List<Contentlet> existingRelationships = relationshipAPI.dbRelatedContent(relationship, reCheckedinContent); assertTrue(existingRelationships.containsAll(relatedContent)); } finally { contentletAPI.archive(blogContent, user, false); contentletAPI.delete(blogContent, user, false); <START> for(Contentlet c : relatedContent){ <END> contentletAPI.archive(c, user, false); contentletAPI.delete(c, user, false); } } }</code><technical_language>This loop replaced by: Stream.forEach()</technical_language>

Target:
public void testCheckin1_ExistingContentWithChildAndParentRels_NullRels_ShouldKeepExistingRels() throws DotDataException, DotSecurityException { Contentlet blogContent = null; List<Contentlet> relatedContent = null; try { blogContent = getBlogContent(); final ContentletRelationships relationships = getACoupleOfParentAndChildrenSelfJoinRelationships(blogContent); final Relationship relationship = relationships.getRelationshipsRecords().get(0).getRelationship(); relatedContent = relationships.getRelationshipsRecords().get(0).getRecords(); final List<Category> categories = getACoupleOfCategories(); blogContent = contentletAPI.checkin(blogContent, relationships, categories, null, user, false); contentletAPI.isInodeIndexed(blogContent.getInode()); List<Contentlet> relatedContentFromDB = relationshipAPI.dbRelatedContent(relationship, blogContent); assertTrue(relatedContentFromDB.containsAll(relatedContent)); Contentlet checkedoutBlogContent = contentletAPI.checkout(blogContent.getInode(), user, false); Contentlet reCheckedinContent = contentletAPI.checkin(checkedoutBlogContent, (ContentletRelationships) null, null, null, user, false); List<Contentlet> existingRelationships = relationshipAPI.dbRelatedContent(relationship, reCheckedinContent); assertTrue(existingRelationships.containsAll(relatedContent)); } finally { contentletAPI.archive(blogContent, user, false); contentletAPI.delete(blogContent, user, false); if(UtilMethods.isSet(relatedContent)) { relatedContent.forEach(content -> { try { contentletAPI.archive(content, user, false); contentletAPI.delete(content, user, false); } catch (DotDataException | DotSecurityException e) { throw new RuntimeException(e); } }); } } }