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
3 answers

Regarding compile time error in Map

Please don't consider this question as duplicate although I have a similiar question earlier but this time it is different.. Map m = new LinkedHashMap(); m.put ("123", "23"); m.put ("323", "23"); m.put ("153", "23"); m.put ("623", "23"); m.put…
0
votes
2 answers

String Java find spaces

I have a phrase on a string and I want to split it on other 5 or more string without spaces. For example: String test = "hi/ please hepl meok?"; and I want : String temp1 = "hi/"; String temp2 = "please"; String temp3 = "help"; String temp4 =…
John
  • 31
  • 1
  • 3
  • 8
0
votes
2 answers

Query about data structure in java

i want to count word frequency from multiple files. Moreover, i have these words in these files a1.txt = {aaa, aaa, aaa} a2.txt = {aaa} a3.txt = {aaa, bbb} so, the results must be aaa = 3, bbb = 1. Then, i have define the above data…
chkontog
  • 31
  • 2
0
votes
1 answer

JAX-WS, why LinkedHashMap collection received is empty?

I am building a java webservice which receive a LinkedHashMap as argument. The LinkedHashMap collection has some elements inserted in the client side, but I received it empty in the webservice.
0
votes
4 answers

Get Next key in Linkedhashmap in java

I am creating dynamic tabs.generateTab() method help to set tabs to be shown or not. Like Property to be shown, Info not to be shown, etc. But I am getting stuck in some point. I want to display Property tab. I am passing it like this: String…
psisodia
  • 1,117
  • 5
  • 17
  • 36
0
votes
3 answers

LinkedHashMap ordered by value

I'm trying find a structure similar to a LinkedHashMap that sorts it by its value. I'll need to be able to update the values. I'll be checking the order very often, so I need a solution that avoids sorting the Map every time. something like…
magodiez
  • 741
  • 2
  • 10
  • 23
0
votes
2 answers

Alternative ways of finding and assigning values in LinkedHashMap inside ArrayList

I have a code displayed below and its just working fine. But I was wondering if there are other ways to implement this? Basically what I am doing with 4 loops is to compare and assign a new value to Key of CopyMatrix which is a linkedhashmap inside…
dimas
  • 2,487
  • 6
  • 40
  • 66
0
votes
2 answers

Why is Java automatically casting from String to Integer when reading LinkedHashMap

My Java application is displaying some odd behaviour, and I'm having trouble finding a solution. This code snippet takes the contents of a LinkedHashMap where the keys and values are both of type String and writes them to a text file. configWriter…
apatrick
  • 194
  • 2
  • 14
0
votes
0 answers

How to parse the xml by using XmlPullParser

I am trying to use XmlPullParser to parse the xml file in a format like that abc cde fgh
Eric
  • 357
  • 1
  • 4
  • 14
0
votes
1 answer

Retrieving data from a HashMap in an Adapter (GetView method)

I created a list based on this example: http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/ In GetView method, need to access information that is stored only in the HashMap. I can access using "adapter.getItem…
0
votes
1 answer

Java HashMap Did Not Return Expected Result

I have one doubt regarding xml reading using Stax Parser. Expected Result: hq_seq_mast {SEQ_VAL=SEQ_VAL, 1=column,LAST_SEQ_VAL=LAST_SEQ_VAL, 2=column} db_sequence_info{TNAME=TNAME, 3=column, CNAME=CNAME, 4=column} Actual…
BALASCJP
  • 579
  • 2
  • 10
  • 21
0
votes
1 answer

Randomly generate text, based on a Linkedhashmap of key=String and Value=following Char

I have a LinkedHashMapcalled generateMapwhich contains a string as a key and all possible variations of the following character of this string stored as value(s). Now I'd like to print a random text. (The storage of the String is not the…
dh762
  • 2,259
  • 4
  • 25
  • 44
-1
votes
1 answer

Does remove() change iteration order in LinkedHashMap?

LinkedHashMap has underlying double-linked list, which enables preservation of the insertion order during the iteration. Non-structural changes, i.e. replacement of the value of an already inserted key, does not affect iteration order. However, I am…
Funny
  • 193
  • 8
-1
votes
1 answer

Unable to map API response to pojo

I have a json response "data": { "students": [ { "id": 100, "name": "ABC" }, { "id": 101, "name": "XYZ" } I need to map it to my pojo, something like - public class TempClass { List list_students; } class Temp { Long id; …
N.Rajal
  • 105
  • 2
  • 17
-1
votes
1 answer

How to increase key by 1 in LinkedHashMap when calling method

Please help me find a solution. I need if the word is checked it was added to LinkedHashMap and for each added word the key was increased by 1. I don't know how many words I will write, so I can't use a loop. LinkedHashMap terms= new…
robot
  • 19
  • 4