Skip to content
Advertisement

Tag: hashmap

How can I use an If-statement inside the Collector?

The output I require is like this : The structure of this output is: Map<String, List<Pair<String, String>>> Where “Versions” is the key of the Map and [(“0.1″,”true”),(“0.2″,”false”),(“0.3″,”true”)] this is the value of the Map. Now, inside the Map we have a List like: List<Pair<String, String>> eg is this : [(“0.1″,”true”),(“0.2″,”false”),(“0.3″,”true”)] Where “0.1”,”0.2″,”0.3″ is the key of the Pair and “true”,”false”,”true”

putting value in Treemap understanding issues

I was running through a leetcode problem. and found a solution in the discussion section problem- https://leetcode.com/problems/stock-price-fluctuation/ solution- but I do not understand the following parts. if someone could explain that would be great Answer To solve the problem you need to know how often the stock is traded for a particular price. An example: it was traded at timestamp

Hashmap using lists as a buffer

I need to create a hashmap that can store multiple values for one key, I know multimaps could do this but I also need to keep those value lists to a specific length. I need a each key to store a list of n values with those being the latest n values, i.e if i reached length n and I

Stream API how to modify key and value in a map?

I have a String – Array map that looks like this What I need to do is Create a new map, where key – only numbers extracted from String like this ( key -> key.replaceAll(“\D+”,””); Value – first value from array like this value -> value[0]; Filter an array so that only this paris left where value > 0 I’ve

How to iterate through ArrayList values of HashMap?

A question from a total newbie. Sorry. I have this customersOrders HashMap that takes String as keys and ArrayList<Double> as values. I need to find the total sum of orders for each customer and the maximum total sum in order to find the biggest customer. How do I manage to do that using just nested For loops and HashMap methods?

Advertisement