java.util.Vector

Gregory R. Warnes warnes@biostat.washington.edu
Thu May 18 14:35:00 GMT 2000


Not complete, but good enough for my app.  Implements add(), get(),
set(), and remove().

--- libgcj/libjava/java/util/Vector.java        Tue Apr 11 13:02:48 2000
+++ libgcj-snapshot-2000-05-03/libjava/java/util/Vector.java    Tue May 16
14:15:27 2000
@@ -369,9 +369,11 @@
   // }
 
   // TODO12:
-  // public public boolean add(Object o)
-  // {
-  // }
+  public boolean add(Object o)
+   {
+       addElement(o);
+       return true;
+   }
 
   // TODO12:
   // public void add(int index, Object element)
@@ -409,19 +411,24 @@
   // }
 
   // TODO12:
-  // public Object get(int index)
-  // {
-  // }
-
-  // TODO12:
-  // public boolean remove(Object o)
-  // {
-  // }
-
-  // TODO12:
-  // public Object remove(int index)
-  // {
-  // }
+   public Object get(int index)
+   {
+       return elementAt(index);
+   }
+
+  // TODO12:
+  public boolean remove(Object o)
+  {
+       return removeElement(o);
+  }
+
+  // TODO12:
+  public Object remove(int index)
+  {
+       Object retval = get(index);
+       removeElementAt(index);
+       return retval;
+  }
 
   // TODO12:
   // public boolean removeAll(Collection c)
@@ -434,9 +441,11 @@
   // }
 
   // TODO12:
-  // public Object set(int index, Object element)
-  // {
-  // }
+  public Object set(int index, Object element)
+  {
+       setElementAt(element, index);
+       return element;
+  }
 
   // TODO12:
   // public Object[] toArray()




More information about the Java-patches mailing list