Skip to content

{"",remove}{Last,First}$TYPE for Lists? #338

Open
@rionda

Description

@rionda

Ciao Seba,

The *LinkedOpenHashMap* classes have methods such as first$TYPE, last$TYPE, removeFirst$TYPE, removeLast$TYPE which return a primitive. Would it please be possible to have the same methods also for the List types (and possibly others), to avoid boxing/unboxing ?

My use case is removing a random element from an $TYPEArrayList by overwriting it with the last element of the list, as in list.set(randomIndex, list.removeLast()), and I would like to use removeLast$TYPE() at the end (I understand that I could use list.remove$TYPE(list.size() - 1), but I assume removeLast() wouldn't incur in the cost of range-checking, maybe?)

Thanks,
Matteo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions