xtd 0.2.0
Loading...
Searching...
No Matches

◆ insert()

template<typename type_t >
virtual void xtd::collections::generic::ilist< type_t >::insert ( xtd::size  index,
const type_t &  item 
)
pure virtual

Inserts an item to the xtd::collections::generic::ilist <type_t> at the specified index.

Parameters
indexThe zero-based index at which item should be inserted.
itemThe object to insert into the xtd::collections::generic::ilist <type_t>.
Exceptions
xtd::argument_out_of_range_exception`index` is not a valid index in the xtd::collections::generic::ilist <type_t>.
xtd::not_supported_exceptionThe xtd::collections::generic::ilist <type_t> is read-only.
Remarks
If index equals the number of items in the xtd::collections::generic::ilist <type_t>, then item is appended to the list.
In collections of contiguous elements, such as lists, the elements that follow the insertion point move down to accommodate the new element. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

Implemented in xtd::collections::generic::list< type_t, allocator_t >.