File: AbstractSet.java

package info (click to toggle)
bouncycastle 1.44%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 25,148 kB
  • ctags: 29,306
  • sloc: java: 277,890; xml: 1,881; sh: 974; makefile: 68
file content (42 lines) | stat: -rw-r--r-- 1,036 bytes parent folder | download | duplicates (12)
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;
            }
    }