Home > Back-end >  Jframe in how to convert the list into the Object [] [], and how to [a {}, {}] a transformation [{},
Jframe in how to convert the list into the Object [] [], and how to [a {}, {}] a transformation [{},

Time:12-08

How to:
 
[SSSS {sid=6, sname='mechanical', pid=8, pname='project', uid=null, uname='name'}, SSSS {sid=7, sname='1' mechanical, pid=9, pname='1' project, uid=null, uname='1' name}]

Into:
 
[{sid=6, sname='mechanical', pid=8, pname='project', uid=null, uname="name"}, {sid=7, sname='1' mechanical, pid=9, pname='1' project, uid=null, uname='1' name}]

And how to
 
Object [] columnNames={" A ", "B", "C", "D"}
[SSSS listsj={sid=6, sname='mechanical', pid=8, pname='project', uid=null, uname='name'}, SSSS {sid=7, sname='1' mechanical, pid=9, pname='1' project, uid=null, uname='1' name}].
//this is an error: I do not know how to turn,
Data table=new series (listsj, columnNames);

//this is an error: I do not know how to turn, listsj error
Data table=new series ( listsj columnNames);
The used list. The toArray ();
 Object [] a=listsj. ToArray (); 
System.out.println(a);
Object [] [] aa=(Object [] []) listsj. ToArray ();
System. The out. Println (aa);

Error: can't turn the
 the Exception in the thread "is the AWT - EventQueue - 0" Java. Lang. ClassCastException: [Ljava. Lang. Object; always be cast to the [[Ljava. Lang. Object; 


Recent test:
 
Object [] a=listsj. ToArray ();
//System. Out. Println (a);
Object [] [] aa=new Object [a. ength] [].
Int j=0;
for (int i=0; i Aa [I]=(Object []) a, [I].
}

Error:
 the Exception in the thread "is the AWT - EventQueue - 0" Java. Lang. ClassCastException: bean. AllShuJu always be cast to [Ljava. Lang. Object; 

other solutions,

CodePudding user response:

Alright with two-dimensional array definition

Should be the [[6, 'mechanical', 8, 'project', null, 'name], [6,' mechanical ', 8, 'project', null, 'name']] this format,
  • Related