You need to sign in to do that
Don't have an account?
srikforce
how to add elements of List 1 to List 2
I have created List 1 and List 2
after creating objects to 2 diff classes I have added some elements.
List1.add(obj1); // adding obj1 to the List 1
List2.add(obj2) // adding obj2 to the List 2
Return type for both the Lists are different...
now I would like to return List 2 on debug logs but List 2 should contains elements of both List 1 and List 2...
Please try to resolve this..
thank u so much ,,,,,
Hello srikforce,
Have you tried to change the type of List2 to List<SObject> ?
As long as the list is initialized to List<SObject> it will be fine. (Don't initialize your list by doing something like this: List<Sobject> list2 = [select ....]; because the collection type will be changed from SObject to the type of your soql query.
Try something like this:
Hope it helps,
Chopa