From 74e307684760a215be923021f3fa2c7e0cad6194 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 1 Oct 2005 18:48:45 +0000 Subject: PR classpath/23880: * gnu/java/security/x509/ext/Extension.java (Value.hashCode): New method. * gnu/java/security/der/BitString.java (hashCode): New method. * javax/security/auth/x500/X500Principal.java (hashCode): New method. --- javax/security/auth/x500/X500Principal.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'javax/security') diff --git a/javax/security/auth/x500/X500Principal.java b/javax/security/auth/x500/X500Principal.java index 78c35ade1..fcbb4950a 100644 --- a/javax/security/auth/x500/X500Principal.java +++ b/javax/security/auth/x500/X500Principal.java @@ -140,6 +140,22 @@ public final class X500Principal implements Principal, Serializable // Instance methods. // ------------------------------------------------------------------------ + public int hashCode() + { + int result = size(); + for (int i = 0; i < size(); ++i) + { + Map m = (Map) components.get(i); + for (Iterator it2 = m.entrySet().iterator(); it2.hasNext(); ) + { + Map.Entry e = (Map.Entry) it2.next(); + // We don't bother looking at the value of the entry. + result = result * 31 + ((OID) e.getKey()).hashCode(); + } + } + return result; + } + public boolean equals(Object o) { if (!(o instanceof X500Principal)) -- cgit v1.2.1