Code refactor for AbsoluteMin improvements (#3031)

Fix #3030

Co-authored-by: Yang Libin <szuyanglb@outlook.com>
This commit is contained in:
Cristiano Jesus 2022-04-21 02:34:40 +01:00 committed by GitHub
parent c8b0a201da
commit 1320748c88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,11 +21,8 @@ public class AbsoluteMin {
Arrays.stream(numbers) Arrays.stream(numbers)
.skip(1) .skip(1)
.forEach(number -> { .filter(number -> Math.abs(number) < Math.abs(absMinWrapper.value))
if (Math.abs(number) < Math.abs(absMinWrapper.value)) { .forEach(number -> absMinWrapper.value = number);
absMinWrapper.value = number;
}
});
return absMinWrapper.value; return absMinWrapper.value;
} }