-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleStream.java
More file actions
29 lines (24 loc) · 904 Bytes
/
SimpleStream.java
File metadata and controls
29 lines (24 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;
import java.util.stream.*;
public class SimpleStream {
public static void main(String args[]) throws FileNotFoundException, IOException {
// in caso di upload esterno
try (FileOutputStream fos = new FileOutputStream("file-esterno.txt");
DataOutputStream dos = new DataOutputStream(fos);) {
}
//
List<String> stringList = getStringList();
Map<String, List<String>> map = stringList.stream()
.collect(Collectors.groupingBy(snake -> ("" + snake.charAt(0)).toLowerCase()));
map.entrySet().stream().forEach(System.out::println);
}
public static List<String> getStringList() {
String stringa = "join " + "die";
String[] stringhe = stringa.split(" ");
return Arrays.asList(stringhe);
}
}