mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-07 01:35:16 +08:00
Code refactor for AbsoluteMin improvements (#3031)
Fix #3030 Co-authored-by: Yang Libin <szuyanglb@outlook.com>
This commit is contained in:
@ -21,11 +21,8 @@ public class AbsoluteMin {
|
||||
|
||||
Arrays.stream(numbers)
|
||||
.skip(1)
|
||||
.forEach(number -> {
|
||||
if (Math.abs(number) < Math.abs(absMinWrapper.value)) {
|
||||
absMinWrapper.value = number;
|
||||
}
|
||||
});
|
||||
.filter(number -> Math.abs(number) < Math.abs(absMinWrapper.value))
|
||||
.forEach(number -> absMinWrapper.value = number);
|
||||
|
||||
return absMinWrapper.value;
|
||||
}
|
||||
|
Reference in New Issue
Block a user