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

how to merge 3 hashmap into single linkedhasmap?

I am using eclipse plugin, I have 3 hasmap name like hmTextONLY,hmCOMBO1ONLY,hmCOMBO2ONLY(its contains key,value) then I want to make simple linkedhashmap using with same key from above hashmap, and other thing is index of likedhashmap and key of…
S-IT Java
  • 127
  • 1
  • 13
0
votes
2 answers

I want to Put two arrays value in Map as key-Value

I want to Put two arrays value in LinkedHashMap as key-value. Here is the snippet that I'm using: String[] s = answer.split("\\,"); String[] ss = aa.split("\\,"); System.out.println(ss.length); -->prints 3 …
0
votes
1 answer

HashMaps and Lists reconciliation in Java

My issue is that I need a HashMap which returns a reference to an internal LinkedList when hashMap.get(key) is called— not simply return the value that corresponds to the key. From what I've gathered, a LinkedHashMap enables a doubly-linked list to…
Sam S.
  • 348
  • 1
  • 3
  • 15
0
votes
0 answers

LinkedHashMap Memory leak In JDK 7

I wrote a LRU cache using LinkedHashMap. I use it cache some memory tables. Table size varies from several rows to thousands rows. In order to control the memory more precisely, I set max rows of cache instead of max tables. The cache run in a…
Tang
  • 1
  • 1
0
votes
1 answer

java hashmap cannot convert object

In Hashmap I send a string and a my own class object as parameter i have sent that successfully but when i want that object it cannot be converted it shows the error Main.java:37: error: incompatible types: Object cannot be converted to…
Rahul Kishan
  • 314
  • 4
  • 18
0
votes
0 answers

How can I get a LinkedHashMap sorted by value from an unsorted Map

I have a Map mapping "words" to their number of occurrences in a larger original String. I'm making a word cloud and I need to render the words with the greatest number of occurrences first to make sure they don't get truncated when…
Mike Medina
  • 97
  • 1
  • 6
0
votes
5 answers

Error extending LinkedHashMap

I am trying to extend LinkedHashMap from my Students class. By this I want to bring in all functionalities of a Map like Map.put(value), Map.get(key). I just create the object inside PSVM and not making static references but still I get the below…
Swadhikar
  • 2,152
  • 1
  • 19
  • 32
0
votes
1 answer

java uses gson to parse from json format to map issues

I want to use google's gson to parse from json test to map, here is my code but get a exception: Gson gson = new GsonBuilder().serializeNulls().setLenient().setPrettyPrinting().create(); Map> map = new LinkedHashMap<>(); map =…
Andy Chan
  • 277
  • 5
  • 16
0
votes
1 answer

Inserting values in LinkedHashMap without using the key

I have a table data in CSV format. First row contains all column names(keys) and all subsequent rows are records(values) as shown below: ID,Name,Contact,Address 1,Alex,987654321,CA USA 2,Bob,4489398,LA USA 3,Marley,7236487,Washington I am reading…
0
votes
1 answer

Using linked hash map with arrays as values in Android

My current task is to set background color for several linear layouts according to the seek bar changes. I'm trying to store layouts in a linked HashMap as keys and use arrays with rgb integers as their values. I'm also using random class to set the…
Oleg
  • 11
  • 1
0
votes
2 answers

How to remove listeners from LinkedHashMap objects when key is removed

I have a LinkedHashMap like so: private LinkedHashMap columns = new LinkedHashMap<>(); And I add a Column: columns.put(name, column); Where a Column has an object with listeners. When I remove the column:…
Jimmy Kane
  • 16,223
  • 11
  • 86
  • 117
0
votes
2 answers

How to cast ArrayList> to Comparable?

I want to add y to the x: x.put("y", (Comparable) y); y is defined as: ArrayList> y = new ArrayList>(); Output example of y =[{c=32,a=1, b=2 }, {c=33,a=4, b=5 }] x is defined…
Elham
  • 1
0
votes
0 answers

Get particular range of values in LinkedHashMap with start and end key

I have 2 Maps like below LinkedHashMap m1 = new LinkedHashMap(); Map m2 = new HashMap(); I need to get values from both of the maps but for m2 I have to get range(sets) of values…
Saravanan
  • 67
  • 2
  • 11
0
votes
1 answer

Return individual values from linkedHashMap in Mule

I have an output from a webservice in Mule that returns a linkedHashMap and I need to get the individual values to be dynamically inserted into a template. The template is used to send email through the SMTP connector. I can get all values using MEL…
Slim
  • 5
  • 2
0
votes
2 answers

JAVA - Ordered HashMap Implementation with change key name function

I am trying to create a user interface with a HashMap. Users could change values and change the name of the keys without disturbing the order of the keys. I searched and found the LinkedHashMap. Which kept the order of the keys in most cases. But…
ossobuko
  • 851
  • 8
  • 25