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.
Questions tagged [linkedhashmap]
703 questions
0
votes
0 answers
Find the Mean of a named property in a LinkedHashMap belonging to each of a Collection of Agents
Is there a way to find the Mean of a named property in a LinkedHashMap belonging to each of a Collection of Agents, without iterating the collection?
In plain Java terms, that could be restated as "find the Mean of a property stored in a…

Rich Harding
- 645
- 6
- 14
0
votes
2 answers
LinkedHashMap -> java.util.ConcurrentModificationException
I am getting ConcurrentModificationException when executing the following code:
public void refreshAvailableCaseSettings() throws Exception {
//getAvailableCases() returns reference to the instance variable
LinkedHashMap

javaProf
- 31
- 1
- 5
0
votes
1 answer
Unable to print LinkedHasMap in Java due to ClassCastException while key is correct
I am testing REST api. Below is my JSON response.
[ {
"id" : 1,
"name" : "Chattagram"
}, {
"id" : 2,
"name" : "Rajshahi"
}, {
"id" : 3,
"name" : "Khulna"
}, {
"id" : 4,
"name" : "Barisal"
}, {
"id" : 5,
"name" : "Sylhet"
}, {
…

Black Swan
- 813
- 13
- 35
0
votes
1 answer
LinkedHashMap get(key) return null even when the value is present
The task is to ask for a definitions of some random cards. After I introduce the cards and I access this method, the value corresponding to the key is present and it still returns null.
pair.get(a) always printing null
public static void ask() {
…

sHIFT0O
- 41
- 3
0
votes
1 answer
Java, grouping, sorting and collecting maps using streams
I've got two Maps of shops, I'd like to count how many shops of each brand there is in that first Map, but the brands, are available only in second Map. Then I want to sort my results by descending number of shops of each brand. My code looks like…

Krzysztof Tkacz
- 488
- 2
- 5
- 15
0
votes
0 answers
How can I convert a JSON file to a LinkedHashMap?
I am making a dictionary and I am trying to convert a JSON file of 100 words given by my teacher into a LinkedHashMap. For example:
{
"word": "scatter",
"definitions": [
{
"definition": "strew or distribute over an area",
…
0
votes
1 answer
LRU cache: linkedhashmap and iterator implementation not working
I am trying to create an LRU cache using a LinkedHashMap and the iterator. It works for many of the test cases. But for some of the large test cases, it produces a few incorrect outputs for the get().
To me, the code makes perfect sense. Perhaps, I…
0
votes
1 answer
Same data is getting inserted in every row in excel even though the result set has different data using java
I have a requirement to export the data to excel.
I have written a method passing the result of query i.e., collection object and String array - attrs which is of type LinkedHashMap. The method is shown below. The result of each…

Vivek
- 35
- 5
0
votes
1 answer
How to get a key value from a LinkedHashMap
I am trying to retrieve a LinkedHashMap key value, but I do not find any coherent solution for my problem, I am using firebase power to download the content for the LinkedHashMap but I do not any solution for retrieving the Question key value of the…

ElDeivis
- 50
- 6
0
votes
0 answers
How to get an element of a LinkedHashMap
Hi I have this LinkedHashMap
{0={Question=What is Gravity?, Answer=Whatever}, 1={Question=What is Motion?, Answer=Whatever}}
displayed by the following code=
linkedHashMapForLessonContent = (intent.getSerializableExtra(tags?.LESSON_MAP_TAG_NAME) as…

ElDeivis
- 50
- 6
0
votes
2 answers
java LRU cache: LinkedHashMap with a timestamp?
I need to implement a LRU cache with a expiration time of 600s in Java. I searched and found the built-in LinkedHashMap class. It can remove the oldest elements when the size exceeds a limit, but it doesn't have a expiration time for elements.
What…

Wang Tuma
- 893
- 5
- 14
- 24
0
votes
2 answers
How do I write to one file a K from one Map, and a V from another?
I need to write to csv all the keys from one map in one column, and all the values from a different map in the next column.
I can do either column individually with this code but when I combine, how do I explain this(?), if I have 10 keys and 10…

NielsenVideo
- 3
- 2
0
votes
1 answer
How to Loop the List of LinkedHashMap and get Key and Values in JSTL
My java class is returning the values like List>>. In JSTL, How do I print the LinkedHashMap Key and List .
// Main List
${row.key} // Getting empty key
…

RKCY
- 4,095
- 14
- 61
- 97
0
votes
2 answers
Can someone explain to me construction of this code that uses stream();
So I found a solution to my problem online and it works but I cannot visualise the exact step by step solution here. Also Id like to know how to do the same thing using more basic structures of a language like standard foreach loop.
UPDATE: so I got…

Zelefrion
- 11
- 3
0
votes
1 answer
why can't I access the value of my HashMap using a dynamic key (jsp, jstl, el)?
Sorry, I know this seems similar to other questions but I still can't work out the solution.
I have a LinkedHashMap metadata set as a session attribute. (ExperimentMetadata is a javabean.) I want to get an attribute from a…

Kate
- 29
- 2