Merged gcj-eclipse branch to trunk.

From-SVN: r120621
This commit is contained in:
Tom Tromey
2007-01-09 19:58:05 +00:00
parent c648dedbde
commit 97b8365caf
17478 changed files with 606493 additions and 100744 deletions
+20 -13
View File
@@ -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();
}
}