diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/sevenUnits/unit/LinearUnitValue.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main/java/sevenUnits/unit/LinearUnitValue.java b/src/main/java/sevenUnits/unit/LinearUnitValue.java index a8848fc..e239b49 100644 --- a/src/main/java/sevenUnits/unit/LinearUnitValue.java +++ b/src/main/java/sevenUnits/unit/LinearUnitValue.java @@ -126,11 +126,10 @@ public final class LinearUnitValue { final List<LinearUnit> others) { if (others.size() < 1) throw new IllegalArgumentException("Must have at least one unit"); - final ObjectProduct<BaseUnit> unitBase = others.get(0).getBase(); for (final LinearUnit unit : others) { - if (!unitBase.equals(unit.getBase())) + if (!Objects.equals(this.unit.getBase(), unit.getBase())) throw new IllegalArgumentException( - "All units must have the same base."); + "All provided units must have the same base as the value."); } LinearUnitValue remaining = this; |