aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/main/jdk1.1/java/util/AbstractSet.java
blob: 45bbb22f6a07b913d0c5deb98e1e0930a5fe60ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package java.util;

/**
 * Title:
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:
 * @version 1.0
 */

public abstract class AbstractSet extends AbstractCollection implements Set
    {
        protected AbstractSet()
            {
            }

        public boolean equals(Object o)
            {
                if(this==o)
                    return true;
                if(o==null)
                    return false;
                if(!(o instanceof Set))
                    return false;
                if(((Set)o).size()!=size())
                    return false;
                return containsAll((Collection)o);
            }

        public int hashCode()
            {
                int hashCode=0;
                Iterator it=iterator();
                while(it.hasNext())
                    {
                        Object o=it.next();
                        if(o!=null)
                          hashCode+=o.hashCode();
                    }
                return hashCode;
            }
    }