Questions tagged [linkedhashmap]

LinkedHashMap is a Hash table and linked list implementation of the Map interface in the Java Standard library. This implementation provides a predictable iteration order, in contrast with the unspecified ordering provided by HashMap, which is normally the order in which keys were inserted into the map.

703 questions
0
votes
1 answer

Jackson won't map to a customized listener map object?

So I've been developing a small LinkedHashMap extension class for use in one of my projects, where I've edited it to have a value change listener in the put method. Heres my map class: static class MapWithListeners extends LinkedHashMap
TheBudderBomb
  • 73
  • 1
  • 3
  • 14
0
votes
1 answer

LinkedHashSet alternative in python

Iterator i1=h1.iterator(); while(i1.hasNext()){ int p=(int)(i1.next()); } Please explain this code in python programming language term, here h1 is linkedhashset Thanks in advance
livikmap99
  • 31
  • 2
0
votes
3 answers

How to sort a HashMap by value but keep the order of duplicates?

I'm trying to sort the tableProbability map into a new one called sorted. In tableProbability the values are the following: Key Value M 0.1 U 0.3 L 0.3 T 0.2 I 0.1 I have the following code that sorts the…
0
votes
0 answers

Redis Ordered Set of objects with O(1) retrieval by a GUID key and sorted by another 64-bit signed integer key in descending order

I have a map of sets of unique objects, unique based on it's GUID as key, and sorted by timestamp, a 64-bit signed integer in descending order. The sets are keyed by a GUID and every individual object in the each set should be able to be retrieved…
Kok How Teh
  • 3,298
  • 6
  • 47
  • 85
0
votes
0 answers

Casting Object to LinkedHashMap

I have parsed a json string using ObjectMapper into Map. Now while I am debugging this map, I see it's effectively a multi-level LinkedHashMap. So, I would like to convert this Map to Map using…
Joy
  • 4,197
  • 14
  • 61
  • 131
0
votes
1 answer

How to create LinkedHashMap with equality that manage order

In my unit test, I need to test order of elements as that : test("Check map order", () { LinkedHashMap actualMap = LinkedHashMap(); actualMap["0"] = "firstValue"; actualMap["1"] = "secondValue"; LinkedHashMap
0
votes
2 answers

How to get they key and value of a LinkedHashMap randomly?

I'm trying to write a little vocabulary test. The LinkedHashMap vocabulary consists of vocabulary. They key is a french word and the value is an english word. I already have a GUI but I'm struggling to get a random french word from the vocabulary…
newlearner
  • 149
  • 1
  • 11
0
votes
2 answers

Adding Upon a Value in a Linkedhashmap

I am iterating through several text files and I am trying to find the top 20 words amongst all the text files. I have managed to set up some code to find the top 20 words in a single file. However, now I am struggling with several files. I have a…
0
votes
1 answer

Remove Key:Value property from YAML File using Java

Goal: I have a YAML file that needed to remove some key: value properties from. Then I want to create a new YAML file with doesn't exist removed key: value properties. The required key should be removed from the whole YAML file. Expected Result:…
Nadee
  • 342
  • 1
  • 6
  • 18
0
votes
1 answer

Java - Map retrieve the inner-map value

I'm converting the JSON file into Map Object, and below is the output [ INV: [[ TestCaseID:MKP, TestData: [ [ Controltype:text, Label:Title, …
Prabu
  • 3,550
  • 9
  • 44
  • 85
0
votes
2 answers

Java Print Value Object on Map

I set list on another class List dataList = new ArrayList(); parsed on class for(DataModel list : dataList) { final String[] data = {list.getVar_a(), list.getVar_b()}; System.out.println("out data"); …
Budi Santoso
  • 13
  • 1
  • 2
0
votes
2 answers

The value in LinkedHashMap cleared when I try to clear the object value (Java)

i got a problem when using LinkedHashMap. I try to store some value in it and then updated it. I'm using String for the key and List for the value. I put 2 value on the List and put them to LinkedHashMap. the next step, i want to update one of the…
Akbar
  • 5
  • 4
0
votes
3 answers

How to sort HashMap by referring another HashMap

I have two HashMap in Java. First one contains a key and its value. Where second contains an evaluation index (order) of that keys. I want to sort the first map by referring to the second map. First HashMap
kandarp
  • 991
  • 1
  • 14
  • 35
0
votes
2 answers

ModelMapper LinkedHashMap to LinkedHashMap ArrayIndexOutOfBoundsException

I've been working on a project where some new status data is fetched into an object and applied via ModelMapper on the current object status data. Fields are matched and updated automatically which is nice. Now I've added some more complex data in…
Paul
  • 2,813
  • 2
  • 19
  • 12
0
votes
3 answers

How to insert triple items in a map in Java?

So, the main idea is to create for example: Map, Integer> map = new LinkedHashMap<>(); And I need to put in this map for example items: {{France=Paris}=12, {Spain=Madrid}=2, ... } How to make this? How to implement the "put"…