public void swap(int index1, int index2, int len) {
    	checkRange(index1, len);
    	checkRange(index2, len);
    	if ((index1 < index2 && index1+len > index2) ||
    		index1 > index2 && index2+len > index1) {
    		throw new IndexOutOfBoundsException("Swap ranges overlap");
    	}

    	for (int i=0; i<len; i++) {
    		E swap = doGet(index1+i);
    		swap = doReSet(index2+i, swap);
    		doReSet(index1+i, swap);
    	}
    }
Swap the specified elements in the list.

@param index1	index of first element in first range to swap
@param index2	index of first element in second range to swap
@param len		number of elements to swap
@throws 			IndexOutOfBoundsException if the ranges are invalid
jphp-runtime/src/php/runtime/memory/support/IList.java