diff options
Diffstat (limited to 'libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java')
-rw-r--r-- | libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java b/libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java new file mode 100644 index 000000000..2a91c4766 --- /dev/null +++ b/libraries/spongycastle/core/src/main/j2me/java/util/AbstractSet.java @@ -0,0 +1,46 @@ +package java.util; + +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; + } +} |