JavaMoney / jsr354-ri

JSR 354 - Moneta: Reference Implementation
Other
344 stars 101 forks source link

Small microoptimization #245

Closed stokito closed 5 years ago

stokito commented 6 years ago

ReciprocalOperator.apply(): use BigDecimal.ONE constant instead of creation of a new BigDecimal object. Also I added a separate commit where used static imports to make the code more concise. Some of them like RoundingMode.HALF_EVEN and Objects.requireNonNull are widely used across the project and in the same time their meaning is clear and not need to be scpcified with class name prefix. So in my opinion it would be good to change them too. Will yo accept this commit? If no then I can revert it. If you ok with that static imports then I'll send another PR with the same static import in other files.


This change is Reviewable

otaviojava commented 6 years ago

@keilw I'm fine with this change.

stokito commented 5 years ago

Hi @otaviojava and @keilw What about to use static imports as in this PR, i.e.:

 import static java.math.BigDecimal.ONE;
 import static java.math.RoundingMode.HALF_EVEN;
 import static java.util.Objects.requireNonNull;

If you ok with that static imports then I'll send another PR with the same static import in other files.

so is it ok?

otaviojava commented 5 years ago

I like static imports

atsticks commented 5 years ago

+1 also from my side.