0
votes
2answers
47 views

Creating a map with a collection as the Key?

Is it possible to create a map where the key is a Collection (any sort of collection)? If I try it on most common collections I'm told the collection can't be cast to comparable. I've been trying ...
4
votes
3answers
70 views

Reason behind using linear probing in identityHashMap

As we know in java collections framework every class in Map uses Chaining for collision resolution but IdentityHashMap uses linear probing for the same. Can somebody put some light what is the reason ...
0
votes
4answers
47 views

Assigning arrays as keys and values of a map

I have two arrays of Type String: String [] a; String [] b; and then a map Map<String, String> mapNumeric = new HashMap<String, String>(); I want a to be the keys and b the value. So ...
-3
votes
1answer
42 views

what is better…list of objects or map? [closed]

I have pairs of two values - they could be translated to a map where you put key, value or to a list where you put objects that have the fields that in 'map' world are key and value. Which is better ...
0
votes
2answers
25 views

Difference between treemap and concurrentskiplistmap? Possibility to use NavigableMap with a map structure for duplicate keys?

I'm a beginner in Java. I have a method as below: public void time_filter(Long t1, Long t2){ NavigableMap<Long, Operations_enter> time_map = new TreeMap<Long, Operations_enter>(); ...
1
vote
3answers
42 views

How to put values in Map which is within a Map

How do I put values in this map? public static Map<String, TreeMap<String, SomeClass>> myMap=Collections.synchronizedMap(new TreeMap<String, TreeMap<String,SomeClass>>());
1
vote
2answers
44 views

create a map with extensible key values

I would like to create a map with extensible key values. Currently I have a common project which has some enum. In my main project in which I have included the common project as a dependency, I have ...
0
votes
2answers
29 views

Java: Stacked (layered) maps behind a Map interface?

I need a Map impl which would consist of stacked maps, which I could push() and pop(), and the values would be "added" or "removed" if they belong to the map being pushed/popped. And the values would ...
6
votes
2answers
97 views

Is it okay to make Integer-keyed Maps in Java?

Just like in title. Is it okay to make something like this: HashMap<Integer, Object> foo = new HashMap<>(); Or maybe there's better container that allow adding values at any index? When ...
2
votes
1answer
49 views

Groovy/Java map sort

I have percentage values in map with flags, like- [44.4: true, 0.0: false, 44.4: false, 38.9: false, 0.0 false] I want to sort them in descending order. The code that I'm using loses the duplicate ...
2
votes
5answers
53 views

Sorting by values in HashMap class using Java

I'm trying to get results HashMap sorted by value. This is HashMap's keys and values: map.put("ertu", 5); map.put("burak", 4); map.put("selin", 2); map.put("can", 1); I try to get results like ...
3
votes
4answers
66 views

How to make a JSON String using the key/value from the Map

I am trying to create a JSON String using the corresponding key/value pair. In the below code, I am trying to iterate the list of AttributeValue and then I am trying to makie the JSON String using the ...
0
votes
1answer
33 views

Iterating the LinkedHashMap shows compilation error

Below is the code for AttributeValue class- @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown=true) public class AttributeValue<T> { private T ...
0
votes
2answers
36 views

Custom equation solver error

I am having some difficulties getting my custom equation evaluator to work. I pass it a string read from a text file (no spaces except between string words) as equation as well as passing it a map of ...
1
vote
3answers
37 views

Using a Set with one Class but find with a String

I have a Java Set<MyClass> on which I've overridden equals and hashCode to use the String name; variable. public class MyClass{ final String name; public boolean equals(Object o){...} ...

1 2 3 4 5 82
15 30 50 per page