The result we want is:
[Regntypecharge: NULL, null, 1, null,]
[Regntypecharge: NULL, null, hehe, null,]
Com. [email protected] addbf1
Com. [email protected] 42e816
The required code is:
Package com. kompakar. eHealth. server. regn. mstr. Common. Service. impl;
Import java. util. arraylist;
Import java. util. List;
Import com. kompakar. eHealth. model. Bridge. Bo. regntypecharge;
Import com. kompakar. eHealth. model. regn. mstr. Common. View. regntypechargeview;
Public class test {
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
Regntypecharge BO = new regntypecharge ();
Bo. setvisittype ("1 ");
Regntypecharge bo2 = new regntypecharge ();
Bo2.setvisittype ("hehe ");
List <regntypecharge> List = new arraylist <regntypecharge> ();
List. Add (BO );
List. Add (bo2 );
List <regntypechargeview> list2 = new arraylist <regntypechargeview> ();
// Regntypechargeview view = new regntypechargeview ();
For (INT I = 0; I <list. Size (); I ++ ){
Regntypechargeview view = new regntypechargeview ();
View. setregntypecharge (list. Get (I ));
List2.add (View );
}
System. Out. println (list2.get (0). getregntypecharge ());
System. Out. println (list2.get (1). getregntypecharge ());
System. Out. println (list2.get (0 ));
System. Out. println (list2.get (1 ));
}
}
If you write this statement:
Package com. kompakar. eHealth. server. regn. mstr. Common. Service. impl;
Import java. util. arraylist;
Import java. util. List;
Import com. kompakar. eHealth. model. Bridge. Bo. regntypecharge;
Import com. kompakar. eHealth. model. regn. mstr. Common. View. regntypechargeview;
Public class test {
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
Regntypecharge BO = new regntypecharge ();
Bo. setvisittype ("1 ");
Regntypecharge bo2 = new regntypecharge ();
Bo2.setvisittype ("hehe ");
List <regntypecharge> List = new arraylist <regntypecharge> ();
List. Add (BO );
List. Add (bo2 );
List <regntypechargeview> list2 = new arraylist <regntypechargeview> ();
Regntypechargeview view = new regntypechargeview ();
For (INT I = 0; I <list. Size (); I ++ ){
// Regntypechargeview view = new regntypechargeview ();
View. setregntypecharge (list. Get (I ));
List2.add (View );
}
System. Out. println (list2.get (0). getregntypecharge ());
System. Out. println (list2.get (1). getregntypecharge ());
System. Out. println (list2.get (0 ));
System. Out. println (list2.get (1 ));
}
}
This will result in
[Regntypecharge: NULL, null, hehe, null,]
[Regntypecharge: NULL, null, hehe, null,]
Com. [email protected] addbf1
Com. [email protected] addbf1