swap()

Reverse the positions of two business objects in a business object array. Keep in mind that the first element in the array is zero (0), the second is 1, the third is 2, and so on.

Syntax

void swap(int index1, int index2)

Parameters

index1
The array position of one element you want to swap.

index2
The array position of the other element you want to swap.

Examples

The following example uses swap() to reverse the positions of BusObjA and BusObjC in the following array:
The figure shows an array with the following business objects: busobja, busobjb and busobjc

swap(0,2);

The result of the call to swap() is the following array:
The figure shows the result of the swap method. In the resulting array, the business objects are: busobjc, busobjb and busobja.

Copyright IBM Corp. 1997, 2004