Przeglądaj źródła

Refactors lambda in Series constructor

Ilya Khadykin 9 lat temu
rodzic
commit
13e36bc057
1 zmienionych plików z 4 dodań i 5 usunięć
  1. 4
    5
      exercises/series/src/example/java/Series.java

+ 4
- 5
exercises/series/src/example/java/Series.java Wyświetl plik

@@ -10,11 +10,10 @@ public class Series {
10 10
     private List<Integer> digits;
11 11
 
12 12
     public Series(String string) {
13
-        this.digits = Arrays
14
-                .asList(string.split(("")))
15
-                .stream()
16
-                .map(digit -> Integer.parseInt(digit))
17
-                .collect(Collectors.toList());
13
+        this.digits =
14
+                Arrays.stream(string.split(("")))
15
+                        .map(Integer::parseInt)
16
+                        .collect(Collectors.toList());
18 17
         this.digitsSize = this.digits.size();
19 18
     }
20 19