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
1 answer
LinkedHashMap in java
I was seeing the source code of LinkedHashMap ,when the instance of LinkedHashMap is created it first it creates header, and when a new entry is added into the LinkedHashMap it adds the particular entry before the header, I am not able to understand…

ZohebSiddiqui
- 209
- 3
- 4
- 14
0
votes
4 answers
which one is better to sort linked items , Hashmap or linkedhashmap or any other?
I have 2 strings from twitter JSON "follower_count" and "user id"
i need something to sort them according to favourite count in descending order,
i.e with greater Follower count gets placed first and then access their "user id" link.
and print from…

user3455103
- 43
- 1
- 4
0
votes
2 answers
Which is better to use among ArrayList and LinkedHashMap for better speed if key/value datastructure is required
I need to maintain key/value pairs. I need to maintain the insertion order also. I know two approaches to do it:
Using ArrayList where each object would be of type entity containing key/value pairs as in ListData described below:
class…

user2971387
- 109
- 1
- 3
- 11
0
votes
1 answer
extracting data from the list on a certain condition
I have a map as shown below:
Key Value
23 20
32 20 (20+20 =40 , min=23 max=32)
43 18
45 24 (24+18 =42 , since 42 >40 so here min and max will be same that is 43
47 10
56 6 …

user3247872
- 27
- 3
0
votes
5 answers
In Android, how do I order a LinkedHashMap?
I have a LinkedHashMap that stores an order number as the key and a string value as value:
{12,"apple"}
{1,"grape"}
{23,"pineapple"}
{2,"pear"}
{16,"cherry"}
I need to sort them by key before I do anything else with them. I'm looking into writing a…

dcp3450
- 10,959
- 23
- 58
- 110
0
votes
2 answers
Put value LinkedHashMap multidimensional
I have the following structure:
import java.util.LinkedHashMap;
...
LinkedHashMap level0 = new LinkedHashMap();
LinkedHashMap level1 = new LinkedHashMap();
LinkedHashMap

Protomen
- 9,471
- 9
- 57
- 124
0
votes
1 answer
LinkedHashMap contains same Value in all Key
Im new in using LinkedHashMap, Im trying to store every instance of the array(bubble sort algorithm) in a LinkedHashMap by using the method .put, but when i try to retrieved the contents of the linkedhashmap, what i get is a bunch of copies of the…

user3175814
- 11
- 1
0
votes
1 answer
Flexjson unable to deserialize LinkedHashMap
I am deserialising a json object as below
{
"b":"value1",
"a":"value2",
"d":"value3",
"c":"value4",
"f":"value5",
"e":"value6"
}
But i am getting ClassCastException as below
java.lang.ClassCastException:…

u_cant_c_me
- 13
- 8
0
votes
1 answer
JAVA: Adding an instace of my class "Gate" to a map is null
I am having trouble with my code. This is my first time using a Map and for some reason the Gate that is added in the 2nd try block is null. I cannot spot the error. The error first shows itself in the last try block where i get nullpointer when i…

DakkVader
- 142
- 1
- 8
0
votes
2 answers
Adding LinkedHashMap object into ArrayList
Here is my code:
ArrayList> lev3 = new ArrayList>();
LinkedHashMap lev4 = new LinkedHashMap();
for (int k = 0; k < 2; k++) {
lev4.clear();
…

Mark Korzhov
- 2,109
- 11
- 31
- 63
0
votes
0 answers
Filter the arraylist related with LinkedHashMap
I have no idea to filter the arraylist related with Map.
ArrayList

Sandar Min Aye
- 499
- 6
- 15
- 28
0
votes
3 answers
iterating through a linkedhashmap but over a certain range
So i know how to iterate through a whole linkedhashmap from the beginning, but what if I want to only link through a certain portion from it? IE: i want to start from the end and go only 4 elements back. How would I do that and is it possible?

Apprentice Programmer
- 1,485
- 4
- 26
- 39
0
votes
2 answers
Add string representation of a LinkedHashMap
I have a String that has been constructed from another LinkedHashMap using toString method, and I want to do the reverse in creating another LinkedHashMap with this String representation of the previous LinkedHashMap.
Is it possible…

Jono
- 17,341
- 48
- 135
- 217
0
votes
2 answers
LinkedHashMap with ArrayList - How to load ArrayList?
I am fairly new to Java and am trying to load a LinkedHashMap that contains an ArrayList of values. I am trying to load the values from a query result from an API based query result (Salesforce).
Here is the error: "Cannot refer to a non-final…

user2774325
- 39
- 3
- 8
0
votes
2 answers
LinkedHashMap iterating over the keys
I can't confirm this in the documentation but if i have a LinkedHashMap and i call keySet() on it and iterate over this set is it guaranteed to iterate in insertion order?

user1634451
- 5,133
- 6
- 30
- 43