回答編集履歴
1
ソースを一部を修正した
test
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
```java
|
6
|
+
|
7
|
+
import java.util.Arrays;
|
6
8
|
|
7
9
|
public class Hoge {
|
8
10
|
|
@@ -12,31 +14,27 @@
|
|
12
14
|
|
13
15
|
{"イ", "イ"},
|
14
16
|
|
15
|
-
//...
|
16
|
-
|
17
17
|
{"ガ", "ガ"},
|
18
18
|
|
19
|
-
//...
|
20
|
-
|
21
19
|
{"ネ", "ネ"},
|
22
|
-
|
23
|
-
//...
|
24
20
|
|
25
21
|
{"ン", "ン"},
|
26
22
|
|
27
23
|
};
|
28
24
|
|
29
|
-
private static String
|
25
|
+
private static String conv(final String input) {
|
30
26
|
|
31
|
-
|
27
|
+
return
|
32
28
|
|
33
|
-
|
29
|
+
Arrays.stream(table)
|
34
30
|
|
35
|
-
|
31
|
+
.reduce(
|
36
32
|
|
37
|
-
|
33
|
+
input,
|
38
34
|
|
35
|
+
(text, t) -> text.replace(t[0], t[1]),
|
36
|
+
|
39
|
-
|
37
|
+
(a, b) -> null);
|
40
38
|
|
41
39
|
}
|
42
40
|
|
@@ -44,7 +42,7 @@
|
|
44
42
|
|
45
43
|
final String input = "アガネイロ";
|
46
44
|
|
47
|
-
final String out =
|
45
|
+
final String out = conv(input);
|
48
46
|
|
49
47
|
System.out.println(String.format("%s -> %s", input, out));
|
50
48
|
|