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

What is the order of array when derived from Linked hashMap?

I have created one linked hash map and then using that map I have generated Map key array like this : - Map map = new LinkedHashMap<>(); map.put("Str1", "Str1"); map.put("Str1", "Str1"); String[] keyArray=…
Jai
  • 131
  • 2
  • 8
0
votes
1 answer

Keeping order on hash map keys during collecting them

I have the following hash map Map map_1 = new LinkedHashMap<>(); with some keys: e.g. ["hello_1", "hello_2", "hello_3"]. Then, I iterate through these keys using stream API and saving new results in map2: Map map_2 =…
Fab
  • 1,145
  • 7
  • 20
  • 40
0
votes
1 answer

Getting key by value in LinkedHashMap using Java

I have a big LinkedHashMap> . For example: <86, ["abc","def","xyz"]> <32, ["ugy","oop","bbb"]> <..., ...........]> What i want is when user type a Comma separated String(e.g "abc,oop,bbb"), i want to print out the key. In…
user7780446
0
votes
1 answer

Saving Revision in Cloudant Sync as an ordered LinkedHashMap, but not keeping the field's order in the server database (Cloudant), after replication

This is the inspection of the Revision object, with the LinkedHashMap correctly ordered After saving it, if I retrieve the same document, I get this. The 'body' field of the 'retrieved' object appears to be correctly ordered, but if I get it as a…
R44
  • 153
  • 1
  • 9
0
votes
1 answer

How to put a String of characters in a HashMap before storing them in an array?

The input my program gets are a few strings of characters which represents rows in a matrix. I would like to put the columns of this matrix in a LinkedHashMap, but without first storing everything in an array and then construct the columns and put…
borisjo
  • 158
  • 1
  • 16
0
votes
2 answers

How to access to a hashmap keyset with arraylist

Actually, I create a new ArrayList of keyset of a LinkedHashMap every time I want the position of a key. public static Map ObjectsWithId = new LinkedHashMap<>(); public int getId(int number) { return (number <=…
0
votes
3 answers

Comparing two LinkedHashMaps with values as a list

I've asked this question in different ways a couple of times already. Each time I get a breakthrough I encounter another issue. This is also due to the fact that I am not proficient in Java yet and have difficulty with collections like Maps. So…
serendipity
  • 852
  • 13
  • 32
0
votes
1 answer

Comparing two LinkedHashMaps that are not in the exact order

I have two maps that look like this: {PERSON=[Jack Fisher], ORGANIZATION=[Oriole, American League]} {LOCATION=[Oriole], PERSON=[Jack Fisher]} I need to compare them and increment some counters for an Exact Match,Partial Match and No Match. I am…
serendipity
  • 852
  • 13
  • 32
0
votes
1 answer

Not able to override the root element while converting a LinkedHashMap and ConcurrentHashMap Object to xml using XStream()

I am trying to convert map objects (HashMap, LinkedHashMap and ConcurrentHashMap) to xml String using XStream() API. While converting the HashMap I am able to convert my map to xml with my desired root element by setting the alias like…
Karthikeyan
  • 569
  • 1
  • 5
  • 10
0
votes
2 answers

Remove entries from Java LinkedHashMap

I have to compare two Excel files (with different data) and create two new Excel tables: Table 1 contains all matching entries Table 2 contains all entries that not match Therefore I iterate over both Excel files and store the matching entries in…
A. Twitty
  • 1
  • 1
0
votes
2 answers

Is there a way to implement an array of LinkedHashMap?

I am trying to implement an array of LinkedHashMap but I don't know if it's possible... For the moment my code looks like as follows : public class LHMap { public static void main(String[] args) { LinkedHashMap[] map =…
Michaël
  • 3,679
  • 7
  • 39
  • 64
0
votes
1 answer

howto count bytes instead of entries with Java linkedHashMap

this LRU cache implementation is based on Java linkedHashMap https://codereview.stackexchange.com/questions/80247/lru-cache-design-using-linkedhashmap with the eviction condition in removeEldestEntry defined as size() > MAX_ENTRIES. I would rather…
0
votes
1 answer

I cannot return a LinkedHashMap from method and I get null

I use a method to get with volley my json object from server. The part that receives my object works fine, I get my response and I try to put my values into a linkedhashmap. When I try to return my map I get null. My method is like: public static …
user6685097
0
votes
2 answers

How to convert JSON String to Map

sorry for duplicating the question, but my problem is other. I have JSON parser method where I parse from json-string to map. But json-string has a value which is json-string too. Something like that: { "status_code":"255", …
Artificial
  • 23
  • 1
  • 6
0
votes
1 answer

To Implement Parent/Child & get Set of records If i give parent name

I have data as shown as below. Here if Team 1 is parent & having 2 child Team A & Team B. Team A is again a parent & having player names as child. Team B does not have any child. Again in another scenario, Team A is independent parent & contains…
jay thakur
  • 151
  • 2
  • 13