Skip to content

Convenience comparison function javadoc doesn't match implementation #153

Open
@ayush-finix

Description

@ayush-finix

Ex.

 /**
     * Compares two instances of {@link MonetaryAmount}, hereby ignoring non significant trailing
     * zeroes and different numeric capabilities.
     *
     * @param amount the {@link MonetaryAmount} to be compared with this instance.
     * @return {@code true} if {@code amount < this}.
     * @throws MonetaryException if the amount's currency is not equal to the currency of this instance.
     */
    boolean isLessThan(MonetaryAmount amount);

The java doc says that it returns true if amount < this, but every implementation (and a personal reading of this.isLessThan(amount) seems like it should) returns true if this < amount.

Ex with the reference moneta implementation

System.out.println(Money.of(BigDecimal.ONE, Monetary.getCurrency("USD"))
        .isLessThan(Money.of(BigDecimal.TEN, Monetary.getCurrency("USD"))));
true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions