Skip to content

Instantly share code, notes, and snippets.

@aplz
Last active April 4, 2018 12:21
Show Gist options
  • Save aplz/b313330eee320bc7bb83fd5d52ec80a4 to your computer and use it in GitHub Desktop.
Save aplz/b313330eee320bc7bb83fd5d52ec80a4 to your computer and use it in GitHub Desktop.
List<Map<String, Object>> listOfMaps = Lists.newArrayList();
listOfMaps.add(ImmutableMap.of("a",1.0));
listOfMaps.add(ImmutableMap.of("b",1.0));
listOfMaps.add(ImmutableMap.of("b",2.0));
List<Object> allValues = listOfMaps.stream()
.flatMap(map -> map.values().stream())
.collect(Collectors.toList());
assertThat(allValues, Matchers.containsInAnyOrder(1.0,1.0,2.0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment