1 package java.util;
2 
3 public abstract class AbstractSet
4     extends AbstractCollection
5     implements Set
6 {
AbstractSet()7     protected AbstractSet()
8     {
9     }
10 
equals(Object o)11     public boolean equals(Object o)
12     {
13         if (this == o)
14         {
15             return true;
16         }
17         if (o == null)
18         {
19             return false;
20         }
21         if (!(o instanceof Set))
22         {
23             return false;
24         }
25         if (((Set)o).size() != size())
26         {
27             return false;
28         }
29         return containsAll((Collection)o);
30     }
31 
hashCode()32     public int hashCode()
33     {
34         int hashCode = 0;
35         Iterator it = iterator();
36         while (it.hasNext())
37         {
38             Object o = it.next();
39             if (o != null)
40             {
41                 hashCode += o.hashCode();
42             }
43         }
44         return hashCode;
45     }
46 }
47