Source:
<code>private static Publication documentEntity() { Publication result = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_ARTICLE, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addTitle(result, TITLE); addDescription(result, ABSTRACT); setLanguage(result, LANGUAGE); result.setSubject(Lists.newArrayList()); <START> for (String keyword : KEYWORDS) { <END> StructuredProperty subject = new StructuredProperty(); subject.setValue(keyword); result.getSubject().add(subject); } result.setPid(Lists.newArrayList()); for (Entry<String, String> entry : EXT_IDENTIFIERS.entrySet()) { StructuredProperty pid = new StructuredProperty(); pid.setValue(entry.getValue()); Qualifier pidType = new Qualifier(); pidType.setClassid(entry.getKey()); pid.setQualifier(pidType); result.getPid().add(pid); } Journal journal = new Journal(); journal.setName(JOURNAL); result.setJournal(journal); Field<String> dateofacceptance = new Field<>(); dateofacceptance.setValue(String.format("%s-02-29", YEAR)); result.setDateofacceptance(dateofacceptance); Field<String> publisher = new Field<>(); publisher.setValue(PUBLISHER); result.setPublisher(publisher); result.setCollectedfrom(Lists.newArrayList()); for (String id : DATASOURCE_IDS) { KeyValue collFrom = new KeyValue(); collFrom.setKey(id); result.getCollectedfrom().add(collFrom); } Author author = new Author(); author.setName(FIRST_NAME); author.setSurname(SECOND_NAME + ' ' + SECOND_SECOND_NAME); author.setFullname(FULL_NAME); author.setRank(0); result.setAuthor(Lists.newArrayList(author)); return result; }</code><technical_language>I stream iteration :)</technical_language>

Target:
private static Publication documentEntity() { Publication result = minimalEntityBuilder(ID, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_ARTICLE, InfoSpaceConstants.SEMANTIC_CLASS_INSTANCE_TYPE_DATASET); addTitle(result, TITLE); addDescription(result, ABSTRACT); setLanguage(result, LANGUAGE); result.setSubject(Lists.newArrayList()); KEYWORDS.stream().map(keyword -> { StructuredProperty subject = new StructuredProperty(); subject.setValue(keyword); return subject; }).forEach(result.getSubject()::add); result.setPid(Lists.newArrayList()); EXT_IDENTIFIERS.entrySet().stream().map(entry -> { StructuredProperty pid = new StructuredProperty(); pid.setValue(entry.getValue()); Qualifier pidType = new Qualifier(); pidType.setClassid(entry.getKey()); pid.setQualifier(pidType); return pid; }).forEach(result.getPid()::add); Journal journal = new Journal(); journal.setName(JOURNAL); result.setJournal(journal); Field<String> dateofacceptance = new Field<>(); dateofacceptance.setValue(String.format("%s-02-29", YEAR)); result.setDateofacceptance(dateofacceptance); Field<String> publisher = new Field<>(); publisher.setValue(PUBLISHER); result.setPublisher(publisher); result.setCollectedfrom(Lists.newArrayList()); DATASOURCE_IDS.stream().map(id -> { KeyValue collFrom = new KeyValue(); collFrom.setKey(id); return collFrom; }).forEach(result.getCollectedfrom()::add); Author author = new Author(); author.setName(FIRST_NAME); author.setSurname(SECOND_NAME + ' ' + SECOND_SECOND_NAME); author.setFullname(FULL_NAME); author.setRank(0); result.setAuthor(Lists.newArrayList(author)); return result; }