You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Mmmhh if you need something like that quickly the easier thing is subclassing (the class code is really easy). It is of course possible to write all those methods but unfortunately I have zero bandwith to work on this now. You're welcome to try a PR, of course. :)
I'll see what I can do, thank you for the quick answer. I had some hope that it would have been just a quick fix for someone who knew the code, but it seems that's not the case, from your answer =)
It's not difficult. But then you have to write the tests. Check that everything works. It takes some time. I have paper deadline and two people graduating within a week...
Ciao Seba,
The
*LinkedOpenHashMap*
classes have methods such asfirst$TYPE
,last$TYPE
,removeFirst$TYPE
,removeLast$TYPE
which return a primitive. Would it please be possible to have the same methods also for theList
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 inlist.set(randomIndex, list.removeLast())
, and I would like to useremoveLast$TYPE()
at the end (I understand that I could uselist.remove$TYPE(list.size() - 1)
, but I assumeremoveLast()
wouldn't incur in the cost of range-checking, maybe?)Thanks,
Matteo
The text was updated successfully, but these errors were encountered: