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
4 answers
Performance of LinkedHashMap: Big O, Memory cost, etc
It's a newbie question: what is the big O for get/put/contains for LinkedHashMap? As I understand for TreeMap it's O(logN), and for LinkedList (to search/add/delete by value), it is O(N). Does that make LinkedHashMap operates on O(logN), or does it…

Anderson
- 19
- 4
0
votes
1 answer
Problem With adding an LinkedHashMap to an array inside of JSON object
I have this LinkedHashMap {Label=BEER, ID=179039, URL=https://website.website.com/browse/178974/178973/179039, Children=[]}
I also have a JSONObject with a single ArrayList inside of it like this: {"Categories":[]}
I am trying to append this…

jamiefiska
- 9
- 2
0
votes
0 answers
Why Custom Simple Adpater's Filter is not working?
I have two ArrayLists on the programme and I am trying to perform filtering on them. I am using Custom Simple Adapter. I used some codes to perform so but somehow it not working. Codes are as follows. Edittext is used for searching/Filtering.
First…

SanketG
- 9
- 3
0
votes
1 answer
how to write TypeConverter for object in model class
This object is from an API call. I want this object in LinkedHashMap> form, as I have to use both keys and values. If this is not possible what is the best possible way to do this. Do I need to convert this array into…

Sidra Jawaid
- 1
- 1
0
votes
1 answer
Cannot convert a linked hash map to a json object with jackson when talking to the Nationbuidler API
My goal is to update a contact in a nationbuilder nation. Nationbuilder is a SAAS for managing campaigns. a "nation" is simply a list of contacts. The endpoint for updating a contact accepts a JSON object in the request body. The object has the…

GNG
- 1,341
- 2
- 23
- 50
0
votes
1 answer
Is it equivalent between ImmutableMap and unmodifiableMap with HashMap / LinkedHashMap?
Is it equivalent between
return ImutableMap.copyOf(map);
and
return Collections.unmodifiableMap(new HashMap(map));
return Collections.unmodifiableMap(new LinkedHashMap(map));
And is second way thread-safe?
(ImutableMap from Guava, I try second way…

FredSuvn
- 1,869
- 2
- 12
- 19
0
votes
1 answer
Hashmap using next variable to point to the next node if there are several nodes with same key
I'm trying to use Hashmap in Java 8.
I will use the hash function to get the index to put the node with given key and value.
However, if there are nodes with the same key, I have to use Linked List kind of data structure. This is
where I'm…

Minjae Rhee
- 23
- 4
0
votes
4 answers
Java - Convert list of objects to map of map data structure
I am trying to convert List of objects data structure in to Map of Maps.
Map>
String is sports variable
Integer is orderId.
My logic returned below value as shown below. I am looking for better way of achieving…

sudhir
- 219
- 5
- 17
0
votes
2 answers
Groovy: LinkedHashMap value in In quotation marks
I'm new in Groovy.
I make map in loop like this [(nodeRootName): (value)]
And after all conversions conert it in JSON:
def json = new groovy.json.JsonBuilder( map )
And this crash, because in map value not valid.
Map like as…

Антон Букреев
- 360
- 1
- 5
- 13
0
votes
3 answers
Groovy: Call key of LinkedHashMap through a variable
I have recursive function for make map from xml
def get_map(groovy.xml.slurpersupport.Node Node) {
nodeRootName = Node.name()
if (Node.childNodes().size() == 0) {
return [(nodeRootName): (Node.text())]
} else {
subMap =…

Антон Букреев
- 360
- 1
- 5
- 13
0
votes
1 answer
Using user input to iterate and populate a LinkedHashMap, avoiding duplicates without try-catch and searching keys
I'm tryng to write a Flashcard game. I'm using a LinkedHashMap to store cards (word, definition) defined by the user. When the user tries to add a duplicated term or definition, ask again until the user inputs a unique one. Once cardDefinition and…

Facundo Flores
- 27
- 5
0
votes
2 answers
How to retrieve value from linkedhashmap using iterators in Struts2......?
I have function which return LinkedHashMap in Struts2 and i just came to know that we cannot use for loop in struts2 instead we have to use Iterators, and am new to struts
can any on help me to retrieve value from linkedhashmap using iterators,…

Warrior
- 3,184
- 12
- 44
- 53
0
votes
2 answers
Cannot update my Map>
This is a minimized version to a school project I am working on. Details of the project are listed below.
OK. So I am new and rusty at Java so I could really use some help. How can I view the values in my Map> ? I have coders-block!
I have tried…

David Iles
- 31
- 2
0
votes
1 answer
Sort LinkedHashMap by value without losing keys
I have this retrofit response body as LinkedHashMap< String, Json>
"-M74DWOrW0w07BpfmBVo": {
"noteContent": "Note 1 content",
"noteCurrentTime": 1589225588206,
"noteTitle": "Note 1"
},
"-M74Dc2dDAZgVk6q86Rs": {
"noteContent": "Note 2…
user13520662
0
votes
3 answers
How can I print a LinkedHashMap of
So I have a class Spaceship with some private variables, one of which have a LinkedHashMap of another Class and an Integer like this
private LinkedHashMap cargo;
Resource is an Abstract class that has several types of Resources…
user8522137