Explorar el Código

Fixes #420

nth-prime: simplify example implementation
Ajay Bose hace 9 años
padre
commit
da215393e2
Se han modificado 1 ficheros con 1 adiciones y 5 borrados
  1. 1
    5
      exercises/nth-prime/src/example/java/PrimeCalculator.java

+ 1
- 5
exercises/nth-prime/src/example/java/PrimeCalculator.java Ver fichero

33
                 .rangeClosed(2, (int) Math.ceil(Math.sqrt(n)))
33
                 .rangeClosed(2, (int) Math.ceil(Math.sqrt(n)))
34
                 .anyMatch((int i) -> n % i == 0);
34
                 .anyMatch((int i) -> n % i == 0);
35
 
35
 
36
-        if (divisible) {
37
-            return false;
38
-        }
39
-
40
-        return true;
36
+        return !divisible;
41
     }
37
     }
42
 }
38
 }