Patch: Vector addition
Tom Tromey
tromey@cygnus.com
Thu Jul 20 12:28:00 GMT 2000
I'm checking this in. It adds Vector.remove(Object).
2000-07-20 Tom Tromey <tromey@cygnus.com>
* java/util/Vector.java (remove(Object)): Implemented.
Tom
Index: java/util/Vector.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/Vector.java,v
retrieving revision 1.5
diff -u -r1.5 Vector.java
--- Vector.java 2000/04/11 20:02:48 1.5
+++ Vector.java 2000/07/20 19:26:03
@@ -413,10 +413,21 @@
// {
// }
- // TODO12:
- // public boolean remove(Object o)
- // {
- // }
+ public synchronized boolean remove(Object o)
+ {
+ for (int i = 0; i < elementCount; ++i)
+ {
+ if (o == null
+ ? elementData[i] == null
+ : o.equals (elementData[i]))
+ {
+ System.arraycopy (elementData, i, elementData, i + 1,
+ elementCount - i - 1);
+ return true;
+ }
+ }
+ return false;
+ }
// TODO12:
// public Object remove(int index)
More information about the Java-patches
mailing list