Last active
August 29, 2015 14:20
-
-
Save CremboC/40c8b239fe1b713be480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Set<Sample> samplesFromGroups(Collection<Long> ids) { | |
return repository.findAllByIdIn(ids) // get all groups | |
.stream() | |
.map(Group::getSamples) // get samples of each group | |
.flatMap(Set::stream) // flatten into a single set of samples | |
.collect(toSet()); | |
} | |
@Override | |
public Set<Sample> samplesFromGroups(Collection<Long> ids) { | |
return repository.findAllByIdIn(ids) // get all groups | |
.stream() | |
.map(group -> group.getSamples()) // get samples of each group | |
.flatMap(Set::stream) // flatten into a single set of samples | |
.collect(toSet()); | |
} | |
@Override | |
public Set<Sample> samplesFromGroups(Collection<Long> ids) { | |
return repository.findAllByIdIn(ids) // get all groups | |
.stream() | |
.map(new Function<Group, Set<Sample>>() { | |
@Override | |
public Set<Sample> apply(Group group) { | |
return group.getSamples(); | |
} | |
}) // get samples of each group | |
.flatMap(Set::stream) // flatten into a single set of samples | |
.collect(toSet()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment