src/solaris/classes/sun/print/AttributeClass.java

Print this page

        

@@ -23,10 +23,11 @@
  * questions.
  */
 package sun.print;
 
 import java.io.ByteArrayInputStream;
+import java.util.Objects;
 
 public class AttributeClass {
     private String myName;
     private int myType;
     private int nameLen;

@@ -248,13 +249,16 @@
         return myName;
     }
 
     public boolean equals(Object obj) {
         return
-            obj != null &&
             obj instanceof AttributeClass &&
-            obj.toString().equals (((AttributeClass) obj).toString());
+            toString().equals(((AttributeClass) obj).toString());
+    }
+ 
+    public int hashCode() {
+        return Objects.hashCode(toString());
     }
 
     public String toString() {
         return myName;
     }