|
7 | 7 |
|
8 | 8 | public class JoinerSplitter { |
9 | 9 |
|
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 | + |
36 | 40 | } |
0 commit comments