Skip to content

Instantly share code, notes, and snippets.

@masa2146
Created November 6, 2021 18:22
Show Gist options
  • Save masa2146/6df7476a6ed8ece0e1475a96bfadf64d to your computer and use it in GitHub Desktop.
Save masa2146/6df7476a6ed8ece0e1475a96bfadf64d to your computer and use it in GitHub Desktop.

Conver list in list to single list

List<String> keyList = machineDataPayload.getMessages()
          .stream()
          .map(messages ->
                  messages.getParameters()
                          .stream()
                          .map(Parameter::getKey)
                          .collect(Collectors.toList()))
          .flatMap(Collection::stream)
          .collect(Collectors.toList());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment