@Test public void listZoneAtoZ() throws Exception { ZoneInfo about = service.createDefault("about", "about-alias"); ZoneInfo abc = service.createDefault("abc", "abc-alias"); ZoneInfo java = service.createDefault("java", "java-alias"); ZoneInfo groovy = service.createDefault("groovy", "groovy-alias"); Map<String, List<ZoneInfo>> aToZ = service.listZoneAtoZ(); Iterator<String> cat = aToZ.keySet().iterator(); assertEquals("A", cat.next()); assertEquals(asList(abc, about), aToZ.get("A")); assertEquals("G", cat.next()); assertEquals(asList(groovy), aToZ.get("G")); assertEquals("J", cat.next()); assertEquals(asList(java), aToZ.get("J")); }
@Override public Map<String, List<ZoneInfo>> listZoneAtoZ() { Function<ZoneInfo, String> capitalizeFirstChar = zoneInfo -> zoneInfo.getZone() .value() .substring(0, 1) .toUpperCase(); return zoneDao.listOrderByName() .stream() .collect(Collectors.groupingBy(capitalizeFirstChar, LinkedHashMap::new, toList())); }
ZoneServiceImpl implements ZoneService { @Override public Map<String, List<ZoneInfo>> listZoneAtoZ() { Function<ZoneInfo, String> capitalizeFirstChar = zoneInfo -> zoneInfo.getZone() .value() .substring(0, 1) .toUpperCase(); return zoneDao.listOrderByName() .stream() .collect(Collectors.groupingBy(capitalizeFirstChar, LinkedHashMap::new, toList())); } }
ZoneServiceImpl implements ZoneService { @Override public Map<String, List<ZoneInfo>> listZoneAtoZ() { Function<ZoneInfo, String> capitalizeFirstChar = zoneInfo -> zoneInfo.getZone() .value() .substring(0, 1) .toUpperCase(); return zoneDao.listOrderByName() .stream() .collect(Collectors.groupingBy(capitalizeFirstChar, LinkedHashMap::new, toList())); }  }
ZoneServiceImpl implements ZoneService { @Override public Map<String, List<ZoneInfo>> listZoneAtoZ() { Function<ZoneInfo, String> capitalizeFirstChar = zoneInfo -> zoneInfo.getZone() .value() .substring(0, 1) .toUpperCase(); return zoneDao.listOrderByName() .stream() .collect(Collectors.groupingBy(capitalizeFirstChar, LinkedHashMap::new, toList())); }  @Override ZoneInfo loadZone(Zone zone); @Override ZoneInfo createDefault(String zone, String aliasName); @Override ZoneInfo createKaif(String zone, String aliasName); @Override void updateTheme(Zone zone, String theme); @Override Map<String, List<ZoneInfo>> listZoneAtoZ(); @Override List<ZoneInfo> listRecommendZones(); @Override List<ZoneInfo> listCitizenZones(); @Override ZoneInfo createByUser(String zone, String aliasName, Authorization creator); @Override List<ZoneInfo> listAdministerZones(String username); @Override boolean isZoneAvailable(String zone); @Override boolean canCreateZone(Authorization authorization); @Override List<String> listAdministratorsWithCache(Zone zone); }
ZoneServiceImpl implements ZoneService { @Override public Map<String, List<ZoneInfo>> listZoneAtoZ() { Function<ZoneInfo, String> capitalizeFirstChar = zoneInfo -> zoneInfo.getZone() .value() .substring(0, 1) .toUpperCase(); return zoneDao.listOrderByName() .stream() .collect(Collectors.groupingBy(capitalizeFirstChar, LinkedHashMap::new, toList())); }  @Override ZoneInfo loadZone(Zone zone); @Override ZoneInfo createDefault(String zone, String aliasName); @Override ZoneInfo createKaif(String zone, String aliasName); @Override void updateTheme(Zone zone, String theme); @Override Map<String, List<ZoneInfo>> listZoneAtoZ(); @Override List<ZoneInfo> listRecommendZones(); @Override List<ZoneInfo> listCitizenZones(); @Override ZoneInfo createByUser(String zone, String aliasName, Authorization creator); @Override List<ZoneInfo> listAdministerZones(String username); @Override boolean isZoneAvailable(String zone); @Override boolean canCreateZone(Authorization authorization); @Override List<String> listAdministratorsWithCache(Zone zone);  }