Skip to content

Instantly share code, notes, and snippets.

@ricardojob
Last active March 17, 2016 20:25
Show Gist options
  • Save ricardojob/b3051273e7a36c3c6c7f to your computer and use it in GitHub Desktop.
Save ricardojob/b3051273e7a36c3c6c7f to your computer and use it in GitHub Desktop.
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author Ricardo Job
* @mail ricardo.job@ifpb.edu.br
* @since 17/03/2016, 16:31:29
*/
public class RemoveWhitespace {
public static void main(String[] args) {
Map<String, String> map = new HashMap<>();
map.put("para", "Kelson Duarte");
map.put("assunto", "Trabalhao de Conclusão de Curso");
List<String> collect = map.values().stream()
.map(linha -> linha.split("\\s+"))
.flatMap(Arrays::stream)
.collect(Collectors.toList());
collect.forEach(System.out::println);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment