Skip to content

Commit 5f2e51a

Browse files
Added strict equals function for testing AbstractParty equality.
1 parent 114f4fc commit 5f2e51a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=onixlabs-corda-core
22
group=io.onixlabs
3-
version=4.0.0-rc1
3+
version=4.0.0-rc2
44
onixlabs.development.jarsign.keystore=../lib/onixlabs.development.pkcs12
55
onixlabs.development.jarsign.password=5891f47942424d2acbe108691fdb5ba258712fca7e4762be4327241ebf3dbfa3

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Extensions.AbstractParty.kt

+14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ import net.corda.core.crypto.SecureHash
2020
import net.corda.core.identity.AbstractParty
2121
import java.security.PublicKey
2222

23+
/**
24+
* Guarantees strict equality between the current [AbstractParty] and the other [AbstractParty].
25+
*
26+
* @param other The other [AbstractParty] to compare with the current [AbstractParty].
27+
* @return Returns true if the current [AbstractParty] and the other [AbstractParty] are strictly equal; otherwise, false.
28+
*/
29+
fun AbstractParty.strictEquals(other: AbstractParty): Boolean {
30+
val equalByReference = this === other
31+
val equalByThisOther = equals(other)
32+
val equalByOtherThis = other == this
33+
34+
return equalByReference || (equalByThisOther && equalByOtherThis)
35+
}
36+
2337
/**
2438
* Gets the owning keys from an [Iterable] of [AbstractParty].
2539
*

0 commit comments

Comments
 (0)