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

Creating methods by specifying LinkedHashMaps with generic values as a parameter

Let's say I have a super class Car and my sub classes are Honda, Toyota, and Lexus. I have 3 LinkedHashMaps using each sub class as the value: LinkedHashMap hondaModels = new LinkedHashMap(); LinkedHashMap
phamous
  • 177
  • 10
0
votes
2 answers

Possible permutations of string based on LinkedHashMap?

So this problem has been taunting me for days. Any help is greatly appreciated! I have made a LinkedHashMap which stores possible combinations for each part of a string and I'm trying to get all the permutations in an ArrayList of Strings, while…
0
votes
1 answer

Locate a double-value in a Dart-Map between 2 elements

I have got a Map like Map perc = { 0: 0, 20: 1, 27: 2, 33: 3 }; double whereIsThis = 13.52; The Map is sorted by keys ascending. I need to locate the two keys that surround the given double-value, e.g. to get an output like 13.52 is…
BNetz
  • 361
  • 4
  • 20
0
votes
1 answer

How to get evicted value from org.apache.cayenne.util.concurrentlinkedhashmap?

I am using org.apache.cayenne.util.concurrentlinkedhashmap and setting cache capacity by using maximumWeightedCpacity(3000) method once cache reached to its threshold limit it starts evicting the old entries. I need that entries which is getting…
0
votes
0 answers

Groovy: How to join map values/why inconsistent results?

Why does the following Groovy script: def d = ["foo":"lorem", "bar":"ipsum", "baz":"dolor"] def j = d.inject([]) { result, e -> result += e.value }.join() ...result in the desired value of j: loremipsumdolor at https://groovyconsole.appspot.com/…
StoneThrow
  • 5,314
  • 4
  • 44
  • 86
0
votes
1 answer

Sorting LinkedHashMap> by counting the occurrences in ArrayList problem

I have: ArrayList miss; LinkedHashMap> map; How can i sort "maps" by counting the occurrences in "miss"? For example: miss => [3, 7] maps => {1=[0, 3, 6], 4=[2, 3, 4], 6=[0, 3, 7], 11=[1, 3, 6], 17=[2, 6,…
Lozar2605
  • 3
  • 1
0
votes
0 answers

Hashmap to Recycler view Android

I want to render Recyclerview based on a hashmap which contains LinkedHashMap>. I am able to add multiple view holders in Adapter. But unable to track one layout for a hashmap-key for value. please suggest. Thanks in…
Pinki
  • 21,723
  • 16
  • 55
  • 88
0
votes
1 answer

Is HashSet a well-written class?

I'm trying to learn design patterns as good coding practices and I would like to know if a HashSet is considered a well-written class? eg: To construct a LinkedHashSet we use the following constructor public LinkedHashSet(int initialCapacity, float…
iconer
  • 287
  • 1
  • 4
  • 13
0
votes
0 answers

The method 'putIfAbsent' was called on null

I am trying to create a LinkedHashMap and populate it with a DateTime as the key and a List as the value in my flutter app. I keep running into problems with creating this. Here is what I am trying right now without success: List
LostTexan
  • 431
  • 5
  • 18
0
votes
1 answer

How collisions are handled in java LinkedHashMap?

I know that in HashMap collisions are handled using LinkedList at each index if there is a collision the new node is inserted at the end of LinkedList but in the case of LinkedHashMap we use a doubly-linked list but to maintain order here the next…
0
votes
1 answer

Multiple markers at this line - Map.Entry is a raw type. References to generic type Map.Entry should be parameterized

Map params = new LinkedHashMap<>(); params.put("name", "Jinu Jawad"); params.put("email", "helloworld@gmail.com"); params.put("CODE", 1111); params.put("message", "Hello Post Test success"); StringBuilder postData = new StringBuilder(); for…
0
votes
1 answer

How LinkedHashMap in java adding node in same array index where there is already a node?

By my understanding about internal working of LinkedHashMap, it stores values in a array of Node. where Node contains fields : class Node { int hash; K key; V value; Node next; Node prev; } Correct me if I'm wrong,…
0
votes
2 answers

Java - Looping over complex collection of Objects

I have a general question about looping over a collection containing a complex object. I have a Collection, which contains an Array of LinkedHashMap that I'm trying to extract values from. I have tried various loops to get to the…
L Jones
  • 60
  • 6
0
votes
1 answer

selenium - generic function to enter test data in webpage using nested linkedhashmap - how to handle radio buttons

I am using Selenium with Java in POM based hybrid framework. I am trying to develop a generic function to enter data in the webpage. The function accepts a linkedhashmap with key(weblement) and value (testdata to enter) pairs. It works properly so…
Jay
  • 339
  • 1
  • 7
  • 23
0
votes
4 answers

Concurrent exception in Groovy even when changes are made to another LinkedHashMap

I have created a new LinkedHashMap 'workingStrData' using 'strData' and I still get the error. I am trying to remove some items from this LinkedHashMap based of another list. The way strData is structured is strData =…