public function set($index, $element)
    {
        if (!is_null($index)
            && is_scalar($index)
        ) {
            $this->_iterator = null;
            return $this->_items[$index] = $element;
        } else {
            // given index name is not valid
            throw new ListException('Element could not be added to list. Index is not valid.', E_NOTICE);
        }
    }
public function set($index, $element)
    {
        if (!is_null($index)
            && is_scalar($index)
        ) {
            $this->_iterator = null;
            return $this->_items[$index] = $element;
        } else {
            // given index name is not valid
            throw new ListException('Element could not be added to list. Index is not valid.', E_NOTICE);
        }
    }
public function set ( $ index , $ element ) { if ( ! is_null ( $ index ) && is_scalar ( $ index ) ) { $ this -> _iterator = null ; return $ this -> _items [ $ index ] = $ element ; } else { // given index name is not valid throw new ListException ( 'Element could not be added to list. Index is not valid.' , E_NOTICE ) ; } }
add or replace a element to a specified position of the list

@param    int        $index      element index
@param    mixed      $element    element
@return   mixed                  element
@throws   ListException
add or replace a element to a specified position of the list