diff --git a/attributes-kt/src/commonMain/kotlin/space/kscience/attributes/Attributes.kt b/attributes-kt/src/commonMain/kotlin/space/kscience/attributes/Attributes.kt index ab6185520..5eb93bfc0 100644 --- a/attributes-kt/src/commonMain/kotlin/space/kscience/attributes/Attributes.kt +++ b/attributes-kt/src/commonMain/kotlin/space/kscience/attributes/Attributes.kt @@ -140,4 +140,8 @@ public fun > Attributes( attribute: A, ): Attributes = MapAttributes(mapOf(attribute to Unit)) -public operator fun Attributes.plus(other: Attributes): Attributes = MapAttributes(content + other.content) \ No newline at end of file +public operator fun Attributes.plus(other: Attributes): Attributes = when{ + isEmpty() -> other + other.isEmpty() -> this + else -> MapAttributes(content + other.content) +} \ No newline at end of file