List::merge Method
Combines two lists to create a new list.
Syntax
client server public static List merge(List list1, List list2)
Run On
Called
Parameters
- list1
Type: List Class
The first list.
- list2
Type: List Class
The list that will be added to the end of the first to create the new list.
Return Value
Type: List Class
The new list.
Remarks
The types of the lists must be the same.
Examples
The following example creates two lists of integer values, merges them to create a new list, and then prints out the values in the new combined list.
{
List list1 = new List(Types::Integer);
List list2 = new List(Types::Integer);
List combinedList = new List(Types::Integer);
int i;
for(i=1; i<6; i++)
{
List1.addEnd(i);
}
for(i=6; i<11; i++)
{
List2.addEnd(i);
}
combinedList = List::merge(list1, list2);
print combinedList.toString();
pause;
}