private static String generateNewsPaperText( List<Knowledge> knowledgeList, int[] knowledgeIndices, World world) { StringBuilder builder = new StringBuilder(); KnowledgeToDescriptionMapper mapper = new KnowledgeToDescriptionMapper(); List<Integer> knowledgeInts = IntStream.of(knowledgeIndices).boxed().collect(Collectors.toList()); for (int i = 0; i < knowledgeList.size(); i++) { Knowledge knowledge = knowledgeList.get(i); if (knowledgeInts.contains(knowledge.getId())) { builder.append(mapper.getStatementDescription(knowledge, world)).append(". "); } } return builder.toString(); }