Selaa lähdekoodia

raindrops: standardize starter implementation

Stuart Kent 9 vuotta sitten
vanhempi
commit
a4e0234389

+ 4
- 3
exercises/raindrops/src/example/java/RaindropConverter.java Näytä tiedosto

1
-public class RaindropConverter {
1
+class RaindropConverter {
2
 
2
 
3
-    public String convert(int number) {
3
+    String convert(int number) {
4
         String result = "";
4
         String result = "";
5
 
5
 
6
         if (number % 3 == 0) {
6
         if (number % 3 == 0) {
15
             result += "Plong";
15
             result += "Plong";
16
         }
16
         }
17
 
17
 
18
-        if (result == null || result.isEmpty()) {
18
+        if (result.isEmpty()) {
19
             result = Integer.toString(number);
19
             result = Integer.toString(number);
20
         }
20
         }
21
 
21
 
22
         return result;
22
         return result;
23
     }
23
     }
24
+
24
 }
25
 }

+ 0
- 0
exercises/raindrops/src/main/java/.keep Näytä tiedosto


+ 7
- 0
exercises/raindrops/src/main/java/RaindropConverter.java Näytä tiedosto

1
+class RaindropConverter {
2
+
3
+    String convert(int number) {
4
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
5
+    }
6
+
7
+}