在指定位置插入一个元素
@param int $index
@param mixed $item
@throws Exception
774046
protected function insertAt($index, $item)
    {
        if ($this->getReadOnly()) {
            throw new Exception('只读list，不允许执行插入操作', 100100503);
        }

        if ($this->_count === $index) {
            $this->_data[$this->_count++] = $item;
        } elseif ($index >= 0 && $index < $this->_count) {
            array_splice($this->_data, $index, 0, [$item]);
            $this->_count++;
        } else {
            throw new Exception(str_cover('List索引"{index}"已超出范围', [
                '{index}' => $index,
            ]), 100100504);
        }
    }
981442
public void bind(Object item) {
    this.item = item;
    if (onItemBindListener != null) {
      onItemBindListener.onItemBind(itemView, item, getAdapterPosition());
    }
  }
128566
public function removeItem($item)
    {
        if ($item instanceof AbstractEntity) {
            $item = $item->id;
        }
        foreach ($this->value as $index => $entity) {
            if ($entity->id == $item) {
                unset($this->value[$index]);

                return;
            }
        }
    }
265106
public function addItems( array $items, $index = null ) {
		foreach ( $items as $item ) {
			// Check if item exists then remove it first, effectively "moving" it
			$currentIndex = array_search( $item, $this->items, true );
			if ( $currentIndex !== false ) {
				$this->removeItems( [ $item ] );
				// Adjust index to compensate for removal
				if ( $currentIndex < $index ) {
					$index--;
				}
			}
			// Add the item
			$item->setElementGroup( $this );
		}

		if ( $index === null || $index < 0 || $index >= count( $this->items ) ) {
			$this->items = array_merge( $this->items, $items );
		} else {
			array_splice( $this->items, $index, 0, $items );
		}

		// Update actual target element contents to reflect our list
		$this->group->clearContent();
		$this->group->appendContent( $this->items );

		return $this;
	}
436830
public static function at($string, $index)
    {
        if (self::length($string) >= ($index + 1)) {
            return $string[$index];
        }

        exception(StringOutIndexException::class);
    }
31895
public function Item( $index )
	{
		if ( $this->getCount() <= $index && ! $this->_done )
		{
			$count = $this->getCount();
			while ( ! $this->_done && ( $count <= $index))
			{
				if ( $this->_iter->MoveNext() )
				{
					/**
					 * @var XmlNode $node
					 */
					$node = $this->GetNode( $this->_iter->getCurrent() );
					if ( ! is_null( $node ) )
					{
						$this->_list[] = $node;
						$count++;
					}
				}
				else
					$this->_done = true;
			}
		}
		if ( $index >= 0 && count( $this->_list ) > $index )
			return $this->_list[ $index ];
		return null;
	}
240536
public function addItem($item) {
		if (is_object($item)) {
			$modelClass = $this->getModel();
			if (! $item instanceof $modelClass) {
				throw new Exception('Model must be an instance of "' . $modelClass . '"');
			}
			
			$item->setCollection($this);
			
			if ($this->_primary === null) {
				$this->_data[]   = &$item->getDataLinked();
				$this->_models[] = $item;
				
				end($this->_data);
				$this->_map[] = key($this->_data);
			} else {
				if (is_array($this->_primaryDefinition)) {
					$idParts = [];
					
					foreach ($this->_primaryDefinition as $primaryPart) {
						if (! isset($item->$primaryPart)) {
							throw new Exception('Primary part "' . $primaryPart . '" not found');
						}
						
						$idParts[] = $item->$primaryPart;
					}
					
					$id = $this->arrayHashFunction($idParts);
				} else {
					if (! isset($item->{$this->_primary})) {
						throw new Exception('Primary "' . $this->_primary . '" not found');
					}
					
					$id = $item->{$this->_primary};
				}
				
				$this->_map[]       = $id;
				$this->_data[$id]   = &$item->getDataLinked();
				$this->_models[$id] = $item;
			}
		} elseif (is_array($item)) {
			if ($this->_primary === null) {
				$this->_data[] = $item;
				
				end($this->_data);
				$this->_map[] = key($this->_data);
				
			} else {
				if (is_array($this->_primaryDefinition)) {
					$idParts = [];
					
					foreach ($this->_primaryDefinition as $primaryPart) {
						if (! isset($item[$primaryPart])) {
							throw new Exception('Primary part "' . $primaryPart . '" not found');
						}
						
						$idParts[] = $item->$primaryPart;
					}
					
					$id = $this->arrayHashFunction($idParts);
				} else {
					if (! isset($item[$this->_primary])) {
						throw new Exception('Primary "' . $this->_primary . '" not found');
					}
					
					$id = $item[$this->_primary];
				}
				
				$this->_map[]     = $id;
				$this->_data[$id] = $item;
			}
		} else {
			throw new Exception('Unknown type of item: "' . gettype($item) . '"');
		}
		
		return $this;
	}
920299
public function setItem($key, $item) {
		if (is_array($key)) {
			$key = $this->arrayHashFunction($key);
		}
		
		if (! isset($this->_data[$key])) {
			$this->_map[] = $key;
		}
		
		if (is_object($item)) {
			$modelClass = $this->getModel();
			if (! $item instanceof $modelClass) {
				throw new Exception('Model must be an instance of "' . $modelClass . '"');
			}
			
			$item->setCollection($this);
			
			$this->_data[$key]   = &$item->getDataLinked();
			$this->_models[$key] = $item;
		}
		elseif (is_array($item)) {
			$this->_data[$key] = $item;
		}
		else {
			throw new Exception('Unknown type of item: "' . gettype($item) . '"');
		}
		
		return $this;
	}
1282144
public function renderItem($item, $index)
    {
        if (is_string($item)) {
            $content = $item;
            $caption = null;
            $options = [];
        } elseif (isset($item['content'])) {
            $content = $item['content'];
            $caption = ArrayHelper::getValue($item, 'caption');
            if ($caption !== null) {
                $captionOptions = ArrayHelper::remove($item, 'captionOptions', []);
                Html::addCssClass($captionOptions, ['widget' => 'carousel-caption']);

                $caption = Html::tag('div', $caption, $captionOptions);
            }
            $options = ArrayHelper::getValue($item, 'options', []);
        } else {
            throw new InvalidConfigException('The "content" option is required.');
        }

        Html::addCssClass($options, ['widget' => 'carousel-item']);
        if ($index === 0) {
            Html::addCssClass($options, 'active');
        }

        return Html::tag('div', $content . "\n" . $caption, $options);
    }
1308075
public function at( $index ) {
			if ( is_int( $index ) ) {
				if ( $index >= 0 && $index < $this->len ) {
					return $this->items[ $index ];
				} else {
					throw new \browserfs\Exception('Index out of bounds!');
				}
			} else {
				throw new \browserfs\Exception('Invalid argument $index: Expected int');
			}
		}
791850
public final void set(final int index, @NonNull final AbstractItem item) {
        Condition.INSTANCE.ensureNotNull(item, "The item may not be null");
        AbstractItem replacedItem = items.set(index, item);

        if (replacedItem instanceof Item && ((Item) replacedItem).getIcon() != null) {
            iconCount--;
        } else if (replacedItem instanceof Divider) {
            dividerCount--;
        }

        if (item instanceof Item && ((Item) item).getIcon() != null) {
            iconCount++;
        } else if (item instanceof Divider) {
            dividerCount++;
        }

        rawItems = null;
        notifyOnDataSetChanged();
    }
743723
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);
        }
    }
1020988
public void updateItem (T item)
    {
        if (_items == null) {
            return;
        }
        int idx = _items.indexOf(item);
        if (idx == -1) {
            _items.add(0, item);
        } else {
            _items.set(idx, item);
        }
    }
254231
public void setIndex(int index) {
        ElementBase parent = getParent();
        
        if (parent == null) {
            CWFException.raise("Element has no parent.");
        }
        
        int currentIndex = parent.children.indexOf(this);
        
        if (currentIndex < 0 || currentIndex == index) {
            return;
        }
        
        parent.moveChild(currentIndex, index);
    }
1021144
private static function createParentNavItem($index, $item)
    {
        $nav_item = array(
            'name' => $item['name'],
            'type' => isset($item['type']) ? $item['type'] : 'structure',
            'index' => $index,
            'children' => array(),
            'limit' => isset($item['limit']) ? $item['limit'] : null
        );

        return $nav_item;
    }
872396
public synchronized ComboBox<V> setItem(int index, V item) {
        if(item == null) {
            throw new IllegalArgumentException("Cannot add null elements to a ComboBox");
        }
        items.set(index, item);
        invalidate();
        return this;
    }
1279234
public function set($index, $element)
    {
        if (is_array($element)
            || ($element instanceof Traversable && !($element instanceof CollectionInterface))
        ) {
            $element = new static($element);
        }

        parent::set($index, $element);

        return $this;
    }