i have one problem with handling list,i have three class named as UserInf,userData,userProcess,i created one generic list using UserInf class, and i need to set that list to another list which is in class userprocess,this my sample code*
public class UserInf
{
private List<Data> pData;
private String userId;
public void setData(List<Data> pData)
{
this.pData=pData;// Need to assign the fpData
}
public List<Data> getData()
{
return this.pData;
}
public void setUserId(String userId)
{
this.userId = userId;
}
public String getUserId()
{
return userId;
}
in my other class userdata i cretaed list using userInf,add adding the value like this
List<UserInf> userInformation=new ArrayList<UserInf>();
UserInf userInfo=new UserInf();
userInfo.setUserId(userid);
userInfo.setData(pdata);
userInformation.add(userInfo);//up to this working fine
}
in my other class userprocees, i want to assign the userInformation list to another list i created object for userInf class ang get the property and assign to my new list
List<UserInf> userProcessList=new ArrayList<UserInf>();
UserInf userProcess=new UserInf();
userProcess.getData();
userProcess.getUserId();
userProcessList.add(userProcess);//problem is here
but this is not working how to assign list to another list like this in java
You could try this: