Here's an example:
Map<String, Student> getStudentsById(Collection<String> ids) {
return ids.stream()
.collect(Collectors.toMap(<id-here>, id -> new Student(id))
}
I'm not sure how to use Collectors.toMap, so that key is the stream element (here in case the ID), and value is some object constructed from the key.