|
|
@@ -4,12 +4,12 @@ import java.util.Arrays;
|
|
4
|
4
|
import java.util.List;
|
|
5
|
5
|
import java.util.stream.Collectors;
|
|
6
|
6
|
|
|
7
|
|
-public class Series {
|
|
|
7
|
+class Series {
|
|
8
|
8
|
|
|
9
|
9
|
private final int digitsSize;
|
|
10
|
10
|
private List<Integer> digits;
|
|
11
|
11
|
|
|
12
|
|
- public Series(String string) {
|
|
|
12
|
+ Series(String string) {
|
|
13
|
13
|
this.digits =
|
|
14
|
14
|
Arrays.stream(string.split(("")))
|
|
15
|
15
|
.map(Integer::parseInt)
|
|
|
@@ -17,7 +17,7 @@ public class Series {
|
|
17
|
17
|
this.digitsSize = this.digits.size();
|
|
18
|
18
|
}
|
|
19
|
19
|
|
|
20
|
|
- public List<List<Integer>> slices(int num) {
|
|
|
20
|
+ List<List<Integer>> slices(int num) {
|
|
21
|
21
|
if (num > this.digitsSize) {
|
|
22
|
22
|
throw new IllegalArgumentException("Slice size is too big.");
|
|
23
|
23
|
}
|
|
|
@@ -31,7 +31,7 @@ public class Series {
|
|
31
|
31
|
return result;
|
|
32
|
32
|
}
|
|
33
|
33
|
|
|
34
|
|
- public List<Integer> getDigits() {
|
|
|
34
|
+ List<Integer> getDigits() {
|
|
35
|
35
|
return digits;
|
|
36
|
36
|
}
|
|
37
|
37
|
|