Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/main/java/javax/money/AbstractContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,7 @@ public boolean equals(Object obj){
public String toString(){
StringBuilder attrsBuilder = new StringBuilder();
for(Map.Entry<Class<?>,Map<Object,Object>> en : this.data.entrySet()){
Map<Object,Object> sortedMap = new TreeMap<>(new Comparator<Object>(){
@Override
public int compare(Object o1, Object o2){
return o1.toString().compareTo(o2.toString());
}
});
Map<Object,Object> sortedMap = new TreeMap<>((o1, o2) -> o1.toString().compareTo(o2.toString()));
sortedMap.putAll(en.getValue());
for(Map.Entry<Object,Object> entry : sortedMap.entrySet()){
Object key = entry.getKey();
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/javax/money/CurrencyUnit.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public interface CurrencyUnit extends Comparable<CurrencyUnit>{
* about the formatting of alternate codes, despite the fact that
* the currency codes must be unique.
*/
public String getCurrencyCode();
String getCurrencyCode();

/**
* Gets a numeric currency code. within the ISO-4217 name space, this equals
Expand All @@ -71,7 +71,7 @@ public interface CurrencyUnit extends Comparable<CurrencyUnit>{
*
* @return the numeric currency code
*/
public int getNumericCode();
int getNumericCode();

/**
* Gets the number of fractional digits typically used by this currency.
Expand All @@ -87,14 +87,14 @@ public interface CurrencyUnit extends Comparable<CurrencyUnit>{
* pseudo-currencies.
*
*/
public int getDefaultFractionDigits();
int getDefaultFractionDigits();


/**
* Returns the {@link javax.money.CurrencyContext} of a a currency. This context contains additional information
* on the type and capabilities of a CurrencyUnit, e.g. its provider and more.
* @return the currency's context, never null.
*/
public CurrencyContext getCurrencyContext();
CurrencyContext getCurrencyContext();

}
76 changes: 38 additions & 38 deletions src/main/java/javax/money/MonetaryAmount.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public interface MonetaryAmount extends CurrencySupplier, NumberSupplier, Compar
*
* @return the currency, never {@code null}
*/
public CurrencyUnit getCurrency();
CurrencyUnit getCurrency();

/**
* Returns the {@link MonetaryContext} of this {@code MonetaryAmount}. The
Expand All @@ -111,7 +111,7 @@ public interface MonetaryAmount extends CurrencySupplier, NumberSupplier, Compar
*
* @return the {@link MonetaryContext} of this {@code MonetaryAmount}, never {@code null} .
*/
public MonetaryContext getMonetaryContext();
MonetaryContext getMonetaryContext();

/**
* Simple accessor for the numeric part of a {@link MonetaryAmount}. The representation type
Expand All @@ -121,7 +121,7 @@ public interface MonetaryAmount extends CurrencySupplier, NumberSupplier, Compar
*
* @return the numeric value of this {@link MonetaryAmount}, never {@code null}.
*/
public NumberValue getNumber();
NumberValue getNumber();

/**
* Queries this monetary amount for a value.
Expand Down Expand Up @@ -192,7 +192,7 @@ default <R> R query(MonetaryQuery<R> query){
* the operator to use, not null
* @return an object of the same type with the specified conversion made, not null
*/
public default MonetaryAmount with(MonetaryOperator operator){
default MonetaryAmount with(MonetaryOperator operator){
return operator.apply(this);
}

Expand All @@ -207,7 +207,7 @@ public default MonetaryAmount with(MonetaryOperator operator){
* @return the new {@code MonetaryAmountFactory} with the given {@link MonetaryAmount} as its
* default values.
*/
public MonetaryAmountFactory<? extends MonetaryAmount> getFactory();
MonetaryAmountFactory<? extends MonetaryAmount> getFactory();

/**
* Compares two instances of {@link MonetaryAmount}, hereby ignoring non significant trailing
Expand All @@ -219,7 +219,7 @@ public default MonetaryAmount with(MonetaryOperator operator){
* @throws MonetaryException
* if the amount's currency is not equals to the currency of this instance.
*/
public boolean isGreaterThan(MonetaryAmount amount);
boolean isGreaterThan(MonetaryAmount amount);

/**
* Compares two instances of {@link MonetaryAmount}, hereby ignoring non significant trailing
Expand All @@ -231,7 +231,7 @@ public default MonetaryAmount with(MonetaryOperator operator){
* @throws MonetaryException
* if the amount's currency is not equals to the currency of this instance.
*/
public boolean isGreaterThanOrEqualTo(MonetaryAmount amount);
boolean isGreaterThanOrEqualTo(MonetaryAmount amount);

/**
* Compares two instances of {@link MonetaryAmount}, hereby ignoring non significant trailing
Expand All @@ -243,7 +243,7 @@ public default MonetaryAmount with(MonetaryOperator operator){
* @throws MonetaryException
* if the amount's currency is not equals to the currency of this instance.
*/
public boolean isLessThan(MonetaryAmount amount);
boolean isLessThan(MonetaryAmount amount);

/**
* Compares two instances of {@link MonetaryAmount}, hereby ignoring non significant trailing
Expand All @@ -255,7 +255,7 @@ public default MonetaryAmount with(MonetaryOperator operator){
* @throws MonetaryException
* if the amount's currency is not equals to the currency of this instance.
*/
public boolean isLessThanOrEqualTo(MonetaryAmount amt);
boolean isLessThanOrEqualTo(MonetaryAmount amt);

/**
* Compares two instances of {@link MonetaryAmount}, hereby ignoring non significant trailing
Expand All @@ -267,14 +267,14 @@ public default MonetaryAmount with(MonetaryOperator operator){
* @throws MonetaryException
* if the amount's currency is not equals to the currency of this instance.
*/
public boolean isEqualTo(MonetaryAmount amount);
boolean isEqualTo(MonetaryAmount amount);

/**
* Checks if a {@code MonetaryAmount} is negative.
*
* @return {@code true} if {@link #signum()} < 0.
*/
public default boolean isNegative(){
default boolean isNegative(){
return signum() < 0;
}

Expand All @@ -283,7 +283,7 @@ public default boolean isNegative(){
*
* @return {@code true} if {@link #signum()} <= 0.
*/
public default boolean isNegativeOrZero(){
default boolean isNegativeOrZero(){
return signum() <= 0;
}

Expand All @@ -292,7 +292,7 @@ public default boolean isNegativeOrZero(){
*
* @return {@code true} if {@link #signum()} > 0.
*/
public default boolean isPositive(){
default boolean isPositive(){
return signum() > 0;
}

Expand All @@ -301,7 +301,7 @@ public default boolean isPositive(){
*
* @return {@code true} if {@link #signum()} >= 0.
*/
public default boolean isPositiveOrZero(){
default boolean isPositiveOrZero(){
return signum() >= 0;
}

Expand All @@ -310,7 +310,7 @@ public default boolean isPositiveOrZero(){
*
* @return {@code true} if {@link #signum()} == 0.
*/
public default boolean isZero(){
default boolean isZero(){
return signum() == 0;
}

Expand All @@ -320,7 +320,7 @@ public default boolean isZero(){
* @return -1, 0, or 1 as the value of this {@code MonetaryAmount} is negative, zero, or
* positive.
*/
public int signum();
int signum();

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this +
Expand All @@ -334,7 +334,7 @@ public default boolean isZero(){
* if the result exceeds the numeric capabilities of this implementation class, i.e.
* the {@link MonetaryContext} cannot be adapted as required.
*/
public MonetaryAmount add(MonetaryAmount amount);
MonetaryAmount add(MonetaryAmount amount);

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this -
Expand All @@ -348,7 +348,7 @@ public default boolean isZero(){
* if the result exceeds the numeric capabilities of this implementation class, i.e.
* the {@link MonetaryContext} cannot be adapted as required.
*/
public MonetaryAmount subtract(MonetaryAmount amount);
MonetaryAmount subtract(MonetaryAmount amount);

/**
* Returns a {@code MonetaryAmount} whose value is <tt>(this &times;
Expand All @@ -362,7 +362,7 @@ public default boolean isZero(){
* if the result exceeds the numeric capabilities of this implementation class, i.e.
* the {@link MonetaryContext} cannot be adapted as required.
*/
public MonetaryAmount multiply(long multiplicand);
MonetaryAmount multiply(long multiplicand);

/**
* Returns a {@code MonetaryAmount} whose value is <tt>(this &times;
Expand All @@ -376,7 +376,7 @@ public default boolean isZero(){
* if the result exceeds the numeric capabilities of this implementation class, i.e.
* the {@link MonetaryContext} cannot be adapted as required.
*/
public MonetaryAmount multiply(double multiplicand);
MonetaryAmount multiply(double multiplicand);

/**
* Returns a {@code MonetaryAmount} whose value is <tt>(this &times;
Expand All @@ -390,7 +390,7 @@ public default boolean isZero(){
* if the result exceeds the numeric capabilities of this implementation class, i.e.
* the {@link MonetaryContext} cannot be adapted as required.
*/
public MonetaryAmount multiply(Number multiplicand);
MonetaryAmount multiply(Number multiplicand);

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this /
Expand All @@ -406,7 +406,7 @@ public default boolean isZero(){
* {@link MonetaryContext} cannot be adapted as required.
* @return {@code this / divisor}
*/
public MonetaryAmount divide(long divisor);
MonetaryAmount divide(long divisor);

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this /
Expand All @@ -422,7 +422,7 @@ public default boolean isZero(){
* {@link MonetaryContext} cannot be adapted as required.
* @return {@code this / divisor}
*/
public MonetaryAmount divide(double divisor);
MonetaryAmount divide(double divisor);

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this /
Expand All @@ -438,7 +438,7 @@ public default boolean isZero(){
* {@link MonetaryContext} cannot be adapted as required.
* @return {@code this / divisor}
*/
public MonetaryAmount divide(Number divisor);
MonetaryAmount divide(Number divisor);

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this % divisor)}.
Expand All @@ -456,7 +456,7 @@ public default boolean isZero(){
* implementation class, i.e. the {@link MonetaryContext} cannot be adapted as
* required.
*/
public MonetaryAmount remainder(long divisor);
MonetaryAmount remainder(long divisor);

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this % divisor)}.
Expand All @@ -474,7 +474,7 @@ public default boolean isZero(){
* implementation class, i.e. the {@link MonetaryContext} cannot be adapted as
* required.
*/
public MonetaryAmount remainder(double divisor);
MonetaryAmount remainder(double divisor);

/**
* Returns a {@code MonetaryAmount} whose value is {@code (this % divisor)}.
Expand All @@ -492,7 +492,7 @@ public default boolean isZero(){
* implementation class, i.e. the {@link MonetaryContext} cannot be adapted as
* required.
*/
public MonetaryAmount remainder(Number divisor);
MonetaryAmount remainder(Number divisor);

/**
* Returns a two-element {@code MonetaryAmount} array containing the result of
Expand All @@ -517,7 +517,7 @@ public default boolean isZero(){
* @see #divideToIntegralValue(long)
* @see #remainder(long)
*/
public MonetaryAmount[] divideAndRemainder(long divisor);
MonetaryAmount[] divideAndRemainder(long divisor);

/**
* Returns a two-element {@code MonetaryAmount} array containing the result of
Expand All @@ -542,7 +542,7 @@ public default boolean isZero(){
* @see #divideToIntegralValue(double)
* @see #remainder(double)
*/
public MonetaryAmount[] divideAndRemainder(double divisor);
MonetaryAmount[] divideAndRemainder(double divisor);

/**
* Returns a two-element {@code MonetaryAmount} array containing the result of
Expand All @@ -567,7 +567,7 @@ public default boolean isZero(){
* @see #divideToIntegralValue(Number)
* @see #remainder(Number)
*/
public MonetaryAmount[] divideAndRemainder(Number divisor);
MonetaryAmount[] divideAndRemainder(Number divisor);

/**
* Returns a {@code MonetaryAmount} whose value is the integer part of the quotient
Expand All @@ -582,7 +582,7 @@ public default boolean isZero(){
* if {@code divisor==0}
* @see java.math.BigDecimal#divideToIntegralValue(java.math.BigDecimal)
*/
public MonetaryAmount divideToIntegralValue(long divisor);
MonetaryAmount divideToIntegralValue(long divisor);

/**
* Returns a {@code MonetaryAmount} whose value is the integer part of the quotient
Expand All @@ -597,7 +597,7 @@ public default boolean isZero(){
* if {@code divisor==0}
* @see java.math.BigDecimal#divideToIntegralValue(java.math.BigDecimal)
*/
public MonetaryAmount divideToIntegralValue(double divisor);
MonetaryAmount divideToIntegralValue(double divisor);

/**
* Returns a {@code MonetaryAmount} whose value is the integer part of the quotient
Expand All @@ -612,7 +612,7 @@ public default boolean isZero(){
* if {@code divisor==0}
* @see java.math.BigDecimal#divideToIntegralValue(java.math.BigDecimal)
*/
public MonetaryAmount divideToIntegralValue(Number divisor);
MonetaryAmount divideToIntegralValue(Number divisor);

/**
* Returns a {@code MonetaryAmount} whose numerical value is equal to ( {@code this} *
Expand All @@ -626,23 +626,23 @@ public default boolean isZero(){
* exceeds the numeric capabilities of this implementation class, i.e. the
* {@link MonetaryContext} cannot be adapted as required.
*/
public MonetaryAmount scaleByPowerOfTen(int power);
MonetaryAmount scaleByPowerOfTen(int power);

/**
* Returns a {@code MonetaryAmount} whose value is the absolute value of this
* {@code MonetaryAmount}, and whose scale is {@code this.scale()}.
*
* @return {@code abs(this)}
*/
public MonetaryAmount abs();
MonetaryAmount abs();

/**
* Returns a {@code MonetaryAmount} whose value is {@code (-this)}, and whose scale is
* {@code this.scale()}.
*
* @return {@code -this}.
*/
public MonetaryAmount negate();
MonetaryAmount negate();

/**
* Returns a {@code MonetaryAmount} whose value is {@code (+this)}, with rounding according to
Expand All @@ -654,7 +654,7 @@ public default boolean isZero(){
* @throws ArithmeticException
* if rounding fails.
*/
public MonetaryAmount plus();
MonetaryAmount plus();

/**
* Returns a {@code MonetaryAmount} which is numerically equal to this one but with any trailing
Expand All @@ -665,6 +665,6 @@ public default boolean isZero(){
*
* @return a numerically equal {@code MonetaryAmount} with any trailing zeros removed.
*/
public MonetaryAmount stripTrailingZeros();
MonetaryAmount stripTrailingZeros();

}
1 change: 0 additions & 1 deletion src/main/java/javax/money/MonetaryAmounts.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.money.spi.MonetaryAmountsSingletonSpi;
import java.util.Collection;
import java.util.Optional;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;

Expand Down
Loading