Answer the question
In order to leave comments, you need to log in
How to add VALUE value to HASHMAP if it is represented as ArrayList?
Good afternoon, there is a Hashmap>. If the key is contained in the hashmap, you need to add another collection to the current collection. I know only one AddAll method, but since it's boolean, doesn't work.
Answer the question
In order to leave comments, you need to log in
You need to use the computeIfPresent
method
And inside the lambda already calculate a new list using addAll, for example.
And if you also need to add an element, in the case when there is no key, just use compute
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question