On Wed, 31 Aug 2022 22:23:42 GMT, Mark Powers <mpow...@openjdk.org> wrote:
>> src/java.base/share/classes/sun/security/pkcs10/PKCS10Attributes.java line >> 184: >> >>> 182: return false; >>> 183: PKCS10Attribute thisAttr, otherAttr; >>> 184: String key; >> >> This whole `toString` method can be enhanced. Can we just compare >> `this.map.equals(that.map)`? > > Don't know what you mean about changing `toString`. I could change `equals` > to something like: > > > public boolean equals(Object other) { > if (!(other instanceof PKCS10Attributes)) > return false; > > Collection<PKCS10Attribute> othersAttribs = > ((PKCS10Attributes)other).getAttributes(); > PKCS10Attribute[] attrs = > othersAttribs.toArray(new PKCS10Attribute[0]); > PKCS10Attributes foo = new PKCS10Attributes(attrs); > return this.map.equals(foo.map); > } Sorry, I meant `equals`. Why cannot we just compare with `other.map`? ------------- PR: https://git.openjdk.org/jdk/pull/9972