Closed rionda closed 1 year ago
Intanto ciao come va? 😂 Well, the standard way to do that is to use an entry iterator and call Entry.setValue()
. Is there any particular reason you don't want to do that? The standard interface (and implementation) does not provide that kind of access because in general it does not make much sense to change a value if you don't know the key (albeit I can make up scenarios, such as scaling counts).
Ciao caro, perdonami =) Tutto bene, e spero anche tu.
Yeah, I think I misinterpreted what Int2IntLinkedOpenHashMap.values().iterator().nextIndex()
and previousIndex()
would return: I thought it would return the key corresponding to the next()
and previous()
values, but that doesn't seem to be the case (please correct me if I'm wrong).
I can definitively use an entry iterator, I didn't think about it.
Nope, these are standard method from the JDK Collection library that return the index in the list of the next/Prev element.
Note that hash maps have a fast entry operator that reuses the same entry at each iteration.
Sounds good. I'm sure I can figure it out =)
Thank you Seba!
This may be a silly question, but would it be, at least theoretically, possible (and possibly not too hard) to support
set(K e)
for theListIterator
returned by, e.g.,Int2IntLinkedOpenHashMap.values().iterator()
?I understand why the one for
keySet().iterator()
can't/should not supportset
, but for thevalues()
view, it should be possible to supportset()
, or am I grossly mistaken?