Source:
public String getHome(Model model) throws IOException { ImmutableMap.Builder<String, String> topSixSelectBuilder = ImmutableMap.builder(); for (PopularSpeciesInfo popularSpeciesInfo: popularSpeciesService.getPopularSpecies(FEATURED_SPECIES)) { topSixSelectBuilder.put( popularSpeciesInfo.species(), StringUtils.capitalize(popularSpeciesInfo.species())); } model.addAttribute("topSixByExperimentCount", topSixSelectBuilder.build()); model.addAttribute( "separator", RANDOM.nextDouble() < EASTER_EGG_PROBABILITY ? BEST_SEPARATOR : NORMAL_SEPARATOR); ImmutableMap.Builder<String, String> speciesSelectBuilder = ImmutableMap.builder(); for (SpeciesProperties speciesProperties : speciesPropertiesTrader.getAll()) { speciesSelectBuilder.put( speciesProperties.referenceName(), StringUtils.capitalize(speciesProperties.referenceName())); } model.addAttribute("species", speciesSelectBuilder.build()); model.addAttribute("speciesPath", ""); model.addAllAttributes(latestExperimentsService.fetchLatestExperimentsAttributes()); model.addAttribute("speciesPath", ""); JsonArray experimentsjsonArray = experimentInfoListService.getExperimentsJson().get("aaData").getAsJsonArray(); ArrayList<Map<String, Object>> experimentsList = GSON.fromJson(experimentsjsonArray, ArrayList.class); Double numberOfAssays = 0.0; ArrayList<String> numberOfSpecies = new ArrayList<>(); for (int i = 0; i < experimentsList.size(); i++) { numberOfAssays += (Double)(experimentsList.get(i).get("numberOfAssays")); if (!numberOfSpecies.contains(experimentsList.get(i).get("species").toString())){ numberOfSpecies.add(experimentsList.get(i).get("species").toString()); } } model.addAttribute("numberOfStudies", experimentsList.size()); model.addAttribute("numberOfAssays", Math.round(numberOfAssays)); model.addAttribute("numberOfSpecies", numberOfSpecies.size()); model.addAttribute("info", atlasInformationDao.fetchAll()); return "home"; }

Target:
public String getHome(Model model) throws IOException { ImmutableMap.Builder<String, String> topSixSelectBuilder = ImmutableMap.builder(); for (PopularSpeciesInfo popularSpeciesInfo: popularSpeciesService.getPopularSpecies(FEATURED_SPECIES)) { topSixSelectBuilder.put( popularSpeciesInfo.species(), StringUtils.capitalize(popularSpeciesInfo.species())); } model.addAttribute("topSixByExperimentCount", topSixSelectBuilder.build()); model.addAttribute( "separator", RANDOM.nextDouble() < EASTER_EGG_PROBABILITY ? BEST_SEPARATOR : NORMAL_SEPARATOR); ImmutableMap.Builder<String, String> speciesSelectBuilder = ImmutableMap.builder(); for (SpeciesProperties speciesProperties : speciesPropertiesTrader.getAll()) { speciesSelectBuilder.put( speciesProperties.referenceName(), StringUtils.capitalize(speciesProperties.referenceName())); } model.addAttribute("species", speciesSelectBuilder.build()); model.addAttribute("speciesPath", ""); model.addAllAttributes(latestExperimentsService.fetchLatestExperimentsAttributes()); model.addAttribute("speciesPath", ""); List<ExperimentInfo> experimentlist = experimentInfoListService.listPublicExperiments(); int numberOfAssays = 0; ArrayList<String> numberOfSpecies = new ArrayList<>(); for (int i = 0; i < experimentlist.size(); i++) { numberOfAssays += experimentlist.get(i).getNumberOfAssays(); if (!numberOfSpecies.contains(experimentlist.get(i).getSpecies())) { numberOfSpecies.add(experimentlist.get(i).getSpecies()); } } model.addAttribute("numberOfStudies", experimentlist.size()); model.addAttribute("numberOfAssays", numberOfAssays); model.addAttribute("numberOfSpecies", numberOfSpecies.size()); Map<String, String> atlasInformation = atlasInformationDao.fetchAll(); model.addAttribute("info", atlasInformation); model.addAttribute("ensembl", AtlasInformationDataType.ENSEMBL.getId()); model.addAttribute("genomes", AtlasInformationDataType.GENOMES.getId()); model.addAttribute("paraSite", AtlasInformationDataType.PARASITE.getId()); model.addAttribute("efo", AtlasInformationDataType.EFO.getId()); return "home"; }