Skip to content

The insert method overwrites the index and adds extraneous value at the end of the ArrayList. #10

@FullValueRider

Description

@FullValueRider

The ArrayList drop in replacement Insert method is in error as it is overwriting the item at the index rather than inserting, and adding an extraneous value at the end of the ArrayList.

Sub TestArrayListItem()
        Dim myAL As ArrayList = ArrayList(Array(10, 20, 30, 40, 50, 60, 70))
        Fmt.Dbg "{0}", myAL
        myAL.Item(3) = 42
        Fmt.Dbg "{0}", myAL
        myAL.Insert 3, 84
        Fmt.Dbg "{0}", myAL
        myAL.Insert 5, 84
        Fmt.Dbg "{0}", myAL
        
    End Sub

gives the folowing output

{10,20,30,40,50,60,70}
{10,20,30,42,50,60,70}
{10,20,30,84,50,60,70,Empty}
{10,20,30,84,50,84,70,0,Empty}

Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions