Bookmark Topic Watch Topic
  • New Topic

Vector into Array

 
J. Alenis
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Report post to moderator
I would like to know if it is possible and how to do the following. I get a created Vector and I need to put it into an Array. Here are pieces of my program:

String [] columnName ={"sqlcode","sqlmessage","predicaat"};
String [] columnIO ={"out","out","in"};
String [] columnType ={"integer","varchar","varchar"};
Object [] columnValue ={"","","'nn>''123456789010'''"};

Vector in = new Vector();
for (int i=0; i<columnName.length;++i)
{Vector row = new Vector();
row.addElement(columnName[i]);
row.addElement(columnIO[i]);
row.addElement(columnType[i]);
row.addElement(columnValue[i]);
in.addElement(row);
}

And I want all the elements in an array that will look like this:

String[][]SP_parms = {{"Out","integer","sqlcode","0"},
{"In","varchar","predicaat","'nn>''123456789010'''"},
{"Out","varchar","sqlmessage",""} };
Can somebody please help me.
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Report post to moderator
An Array is nothing but a collection of similar "type" elements. So, since a Vector is an Object, you can have an array of Objects. I don't think you will need to have a multi-dimensional array, the way you have put it. Just a normal array can be used to hold Object-type elements.

Try it out. It should be possible.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Report post to moderator
Round these parts, posting the same question in multiple forums is bad practice. It can make it rather difficult to follow a conversation, plus folks spend time saying things that were just said.

Please continue in the duplicate thread in the Intermediate forum.
 
    Bookmark Topic Watch Topic
  • New Topic