Add hashCode and equals to AnsiMessageBuilder

This commit is contained in:
Him188 2020-12-01 09:22:00 +08:00
parent b87a5390b9
commit 7fad444a0c

View File

@ -114,6 +114,14 @@ public open class AnsiMessageBuilder public constructor(
} }
override fun compareTo(other: AnsiMessageBuilder): Int = this.delegate.compareTo(other.delegate) override fun compareTo(other: AnsiMessageBuilder): Int = this.delegate.compareTo(other.delegate)
override fun hashCode(): Int = this.delegate.hashCode()
override fun equals(other: Any?): Boolean {
if (other == null) return false
if (other::class.java != this::class.java) return false
other as AnsiMessageBuilder
if (other.delegate != this.delegate) return false
return true
}
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
override fun append(c: Char): AnsiMessageBuilder = apply { delegate.append(c) } override fun append(c: Char): AnsiMessageBuilder = apply { delegate.append(c) }