Skip to content

Commit 5218116

Browse files
committed
Reformat JoinerSplitter
1 parent c670ac9 commit 5218116

1 file changed

Lines changed: 30 additions & 26 deletions

File tree

‎core-java/src/main/java/com/baeldung/streamApi/JoinerSplitter.java‎

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,34 @@
77

88
public class JoinerSplitter {
99

10-
public static String join ( String[] arrayOfString ) {
11-
return Arrays.asList(arrayOfString)
12-
.stream()
13-
.map(x -> x)
14-
.collect(Collectors.joining(","));
15-
}
16-
17-
public static String joinWithPrefixPostFix ( String[] arrayOfString ) {
18-
return Arrays.asList(arrayOfString)
19-
.stream()
20-
.map(x -> x)
21-
.collect(Collectors.joining(",","[","]"));
22-
}
23-
24-
public static List<String> split ( String str ) {
25-
return Stream.of(str.split(","))
26-
.map (elem -> new String(elem))
27-
.collect(Collectors.toList());
28-
}
29-
30-
public static List<Character> splitToListOfChar ( String str ) {
31-
return str.chars()
32-
.mapToObj(item -> (char) item)
33-
.collect(Collectors.toList());
34-
}
35-
10+
public static String join(String[] arrayOfString) {
11+
return Arrays
12+
.asList(arrayOfString)
13+
.stream()
14+
.map(x -> x)
15+
.collect(Collectors.joining(","));
16+
}
17+
18+
public static String joinWithPrefixPostFix(String[] arrayOfString) {
19+
return Arrays
20+
.asList(arrayOfString)
21+
.stream()
22+
.map(x -> x)
23+
.collect(Collectors.joining(",", "[", "]"));
24+
}
25+
26+
public static List<String> split(String str) {
27+
return Stream
28+
.of(str.split(","))
29+
.map(elem -> new String(elem))
30+
.collect(Collectors.toList());
31+
}
32+
33+
public static List<Character> splitToListOfChar(String str) {
34+
return str
35+
.chars()
36+
.mapToObj(item -> (char) item)
37+
.collect(Collectors.toList());
38+
}
39+
3640
}

0 commit comments

Comments
 (0)