I have the below expression
Map<String, String> institutionList = new LinkedHashMap<String, String>();
institutionService.list().forEach(institution -> institutionList.put(institution.getCode(),institution.getName()));
I tried like below.
institutionService.list().stream().collect(Collectors.toMap(Institution::getCode, Institution::getName));
But still error. how to convert this into stream() & map() with lambda?