List to Map (streams)

@Getter @Setter
class Directory {
   Long id;
   String name;
}
 
List<Directory> l = repo.allDirectories();
 
Map<Long, String> m = l.stream()
     .collect(Collectors.toMap(d -> d.getId(), d -> d.getName()));