Say I have the following:
Class myclass
{
public string stra ="", strb = ""
myclass(String a, String b){stra=a;strb=b}
}
//then in the app I want to do:
myclass myclassinst1 = new myclass("blah","xxxx");
myclass myclassinst2 = new myclass("blah2","yyyy");
myclass myclassinst3 = new myclass("blah3","zzzz");
list <myclass> mylist = new ArrayList<myclass>();
mylist.add(myclassinst1 );
mylist.add(myclassinst2 );
mylist.add(myclassinst3 );
//How would I then convert that to a String[] Array of all the stra elements without using a loop.
//eg:
String[] strarr_a = mylist.toarray(myclass.stra);
String[] strarr_b = mylist.toarray(myclass.strb);
//instead of having to do
String[] strarr_a = new String[mylist.size()];
String[] strarr_b = new String[mylist.size()];
for (int i=0;i<mylist.size();i++)
{
strarr_a[i] = mylist.get(i).stra;
strarr_b[i] = mylist.get(i).strb;
}