Stream super pratique. Stream justice et Stream oublieront bientôt. Alors j'ai fait une feuille de triche. Merci pour votre considération.
Arrays.asList("honto", "monde", "dure").stream().forEach(s -> System.out.println(s));
Arrays.asList("Sérieusement", "vraiment", "dure").stream().forEach(System.out::println);
Collections.emptyMap().entrySet()
.forEach(e -> System.out.println(e.getKey() + ":" + e.getValue()));
Arrays.asList("amour", "Amour", "Argent", "rêver").stream()
.filter(s -> s.equals("Amour")).forEach(System.out::println);
Arrays.asList("1", "2", "3", "5").stream()
.map(s -> Integer.valueOf(s)).forEach(System.out::println);
IntStream.range(0, 10).map(i -> i*2).toArray();
Arrays.asList("SU-METAL DEATH!", "YUIMETAL DEATH!", "MOAMETAL DEATH!").stream()
.map(s -> s.split(" ",2)).filter(a -> 2 == a.length)
.collect(Collectors.toMap(a->a[0], a->a[1]));
Arrays.asList("amour", "Amour", "Argent", "rêver").parallelStream()
.findFirst(s -> s.equals("Amour"));
Arrays.asList("Amour,C'est,Sucré","Amour,C'est,fortement","Amour,C'est,noble").stream()
.map(s -> s.split(",")).flatMap(a -> Arrays.asList(a).stream())
.collect(Collectors.toList());
Function<String, String> toHakata = s -> {
return s + "Toyo.";
};
Arrays.asList("Sogyan Kotsunaka").stream().map(toHakata);
Veuillez commenter et tirer la demande.
Recommended Posts