1
0

explicitly throw null ptr exception if function is null

This commit is contained in:
2024-09-09 18:15:43 +03:00
parent 41be2390f3
commit 26ce772cd0

View File

@@ -65,8 +65,12 @@ public class IntegralCalculator {
* @param lowerBound The lower bound of the integration interval.
* @param upperBound The upper bound of the integration interval.
* @return The estimated value of the definite integral.
* @throws NullPointerException if the function is null.
*/
public double calculate(Function<Double, Double> function, double lowerBound, double upperBound) {
if (function == null)
throw new NullPointerException("function cannot be null");
if (lowerBound == upperBound) {
this.callProgressCallback(0, 1);
this.callProgressCallback(1, 1);