protected boolean doReplaceAll(int index, int len, IList<? extends E> list) {
    	// There is a special implementation accepting an IList
    	// so the method is also available in the primitive classes.
    	assert(index >= 0 && index <= size());
    	assert(len >= 0 && index+len <= size());

    	int srcLen = 0;
    	if (list != null) {
    		srcLen = list.size();
    	}
    	doEnsureCapacity(size()-len+srcLen);

    	// Remove elements
   		doRemoveAll(index, len);

   		// Add elements
    	for (int i=0; i<srcLen; i++) {
    		if (!doAdd(index+i, list.doGet(i))) {
    			index--;
    		}
    	}
    	return len > 0 || srcLen > 0;
    }
Replaces the specified range with new elements.
This method is very powerful as it offers the functionality of many other methods
which are therefore only offered for convenience: <br/>
- addAll(index, list) -> replaceAll(index, 0, list) <br/>
- setAll(index, list) -> replaceAll(index, list.size(), list) <br/>
- putAll(index, list) -> replaceAll(index, -1, list) <br/>
- initAll(list)       -> replaceAll(0, this.size(), list) <br/>
- remove(index, list) -> replaceAll(index, list.size(), null) <br/>

@param index index of first element to replace, use -1 for the position after the last element (this.size())
@param len	number of elements to replace, use -1 for getting behavior of putAll()
@param list  list with elements which replace the old elements, use null if elements should only be removed
@throws 		IndexOutOfBoundsException if the range is invalid
jphp-runtime/src/php/runtime/memory/support/IList.java