summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util/AbstractSet.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/java/util/AbstractSet.java')
-rw-r--r--libjava/classpath/java/util/AbstractSet.java33
1 files changed, 20 insertions, 13 deletions
diff --git a/libjava/classpath/java/util/AbstractSet.java b/libjava/classpath/java/util/AbstractSet.java
index f0d7cb19908..423ac8083a6 100644
--- a/libjava/classpath/java/util/AbstractSet.java
+++ b/libjava/classpath/java/util/AbstractSet.java
@@ -1,5 +1,6 @@
/* AbstractSet.java -- Abstract implementation of most of Set
- Copyright (C) 1998, 2000, 2001, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2000, 2001, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -58,7 +59,9 @@ package java.util;
* @since 1.2
* @status updated to 1.4
*/
-public abstract class AbstractSet extends AbstractCollection implements Set
+public abstract class AbstractSet<E>
+ extends AbstractCollection<E>
+ implements Set<E>
{
/**
* The main constructor, for use by subclasses.
@@ -79,9 +82,9 @@ public abstract class AbstractSet extends AbstractCollection implements Set
*/
public boolean equals(Object o)
{
- return (o == this ||
- (o instanceof Set && ((Set) o).size() == size()
- && containsAll((Collection) o)));
+ return (o == this
+ || (o instanceof Set && ((Set) o).size() == size()
+ && containsAll((Collection) o)));
}
/**
@@ -94,7 +97,7 @@ public abstract class AbstractSet extends AbstractCollection implements Set
*/
public int hashCode()
{
- Iterator itr = iterator();
+ Iterator<E> itr = iterator();
int hash = 0;
int pos = size();
while (--pos >= 0)
@@ -119,21 +122,25 @@ public abstract class AbstractSet extends AbstractCollection implements Set
* @see Collection#contains(Object)
* @see Iterator#remove()
*/
- public boolean removeAll(Collection c)
+ public boolean removeAll(Collection<?> c)
{
int oldsize = size();
int count = c.size();
- Iterator i;
if (oldsize < count)
{
+ Iterator<E> i;
for (i = iterator(), count = oldsize; count > 0; count--)
- if (c.contains(i.next()))
- i.remove();
+ {
+ if (c.contains(i.next()))
+ i.remove();
+ }
}
else
- for (i = c.iterator(); count > 0; count--)
- remove(i.next());
+ {
+ Iterator<?> i;
+ for (i = c.iterator(); count > 0; count--)
+ remove(i.next());
+ }
return oldsize != size();
}
-
}