summaryrefslogtreecommitdiff
path: root/src/org/unitConverter/unit/Unit.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/unitConverter/unit/Unit.java')
-rw-r--r--src/org/unitConverter/unit/Unit.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/org/unitConverter/unit/Unit.java b/src/org/unitConverter/unit/Unit.java
index d848ea1..737802a 100644
--- a/src/org/unitConverter/unit/Unit.java
+++ b/src/org/unitConverter/unit/Unit.java
@@ -511,7 +511,8 @@ public abstract class Unit {
public String toString() {
return this.getPrimaryName().orElse("Unnamed unit")
+ (this.getSymbol().isPresent() ? String.format(" (%s)", this.getSymbol().get()) : "")
- + ", derived from " + this.getBase().toString();
+ + ", derived from " + this.getBase().toString(u -> u.getSymbol().get())
+ + (this.getOtherNames().isEmpty() ? "" : ", also called " + String.join(", ", this.getOtherNames()));
}
/**