Search This Blog

Friday, 23 March 2012

How to convert Vector to array.....

Hello friends,
                        This seems not a big issue but sometimes we really need to use array instead of a vector.....sometimes perhaps, so here is the function i got from my anonymous friend ....i thank him very much for this .....

public static void copyVectorToArray(Vector src, Object[] _device2) {
       if(_device2.length != src.size() )
          throw new IllegalArgumentException("Target array length must be size of src vector");
       Enumeration enum = src.elements();
       int count = 0;
       while(enum.hasMoreElements()) {
          Object element = enum.nextElement();
          _device2[count++] = element;

just try this one......

No comments:

Post a Comment