This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Patch: Vector addition
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: Vector addition
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 20 Jul 2000 13:35:27 -0600
- Reply-To: tromey at cygnus dot com
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)