Skip to content

Commit

Permalink
Added strict equals function for testing AbstractParty equality.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMatthewLayton committed Dec 21, 2021
1 parent 114f4fc commit 5f2e51a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=onixlabs-corda-core
group=io.onixlabs
version=4.0.0-rc1
version=4.0.0-rc2
onixlabs.development.jarsign.keystore=../lib/onixlabs.development.pkcs12
onixlabs.development.jarsign.password=5891f47942424d2acbe108691fdb5ba258712fca7e4762be4327241ebf3dbfa3
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ import net.corda.core.crypto.SecureHash
import net.corda.core.identity.AbstractParty
import java.security.PublicKey

/**
* Guarantees strict equality between the current [AbstractParty] and the other [AbstractParty].
*
* @param other The other [AbstractParty] to compare with the current [AbstractParty].
* @return Returns true if the current [AbstractParty] and the other [AbstractParty] are strictly equal; otherwise, false.
*/
fun AbstractParty.strictEquals(other: AbstractParty): Boolean {
val equalByReference = this === other
val equalByThisOther = equals(other)
val equalByOtherThis = other == this

return equalByReference || (equalByThisOther && equalByOtherThis)
}

/**
* Gets the owning keys from an [Iterable] of [AbstractParty].
*
Expand Down

0 comments on commit 5f2e51a

Please sign in to comment.