Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to edit a java map

I have a simple question about a java map.Suppose I have a map that has a key and value already set. How do I change the value of that key; what method would I use?

like image 572
Steffan Harris Avatar asked May 19 '26 01:05

Steffan Harris


1 Answers

Just call a normal put -- it will replace the existing value for the key. If you need to access the old value for that key, the put method returns it.

See the javadoc for more details.

like image 184
Kaleb Brasee Avatar answered May 21 '26 15:05

Kaleb Brasee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!