I have a hashmap that looks something like this:
Map<String, ImageRecipeMap> contentIdToImageIdsMap = new HashMap<>();
my ImageRecipeMap object looks something like this:
public class ImageRecipeMap {
private ContentType contentType;
private List<String> imageIds;
public List<String> getImageIds() {
return imageIds;
}
public void setImageIds(List<String> imageIds) {
this.imageIds = imageIds;
}
...
}
I want to grab all the Lists of imageIds and create a total imageIds list using java 8 streams. This is what I have so far, but I seem to have a compile error on my collect:
List<String> total = contentIdToImageIdsMap.values().stream()
.map(value -> value.getImageIds())
.collect(Collectors.toList());