Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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