Skip to content
Advertisement

Tag: hashmap

Converting String number words to just String number:Java

I’m a beginner coder trying to work on converter for words which should work that way:Input= “zero;six;eight;two” Output = “0682”. But in my case the output I get is “0282”. Are there any solutions to that? Or like maybe I should program differently?. I found that LinkedLists or HashMap could work, if so could you show how? Answer You should

Converting string to Map in java 8

Can someone please guide me on how to achieve the below using Java 8. I don’t know how to get that counter as the key Answer You can use IntStream to get this thing done. Use the integer value as the key, and the relevant value in the string array at that index as the value of the map. Another

handle duplicate key in Collectors.toMap() function

I am creating a map which its (key,value) will be (name, address) in my Person object: In the duplicate key situation, I would like to skip to add the second address to the map and would like to log the name also. Skipping the duplicate address I can do already using mergeFunction, but in oder to log the name I

How can I store nested Hashmap in Redis?

I want to store netsted HashMap in Redis having single key. For example : Please Suggest : Is there any way to store the above-mentioned data structure? How can we achieve this? Answer Redis doesn’t support it as of now. However there is a way to do it, other than rejson. You can convert it into JSON and store in

java.util.Map values() method performance

I have a map like this with several million entries: I need to get list of values, which could be done by calling java.util.Map values() method. Is Collection of values created every time I call values() method or is it pre-computed from performance perspective? As my Map has several millions elements, I do not want to create new list object

map inside a map – Need data in specific format

I have a requirement where I want to read multiple project pom files and display data in below format My coding is getting input on project , ver and technlogy and displaying, but however I couldnt second value inside the internal Please help me understand why I couldnt add 2nd key value pair to Internal map? Is there a better

Advertisement