All Questions
18 questions
0
votes
0
answers
29
views
Compare hashMap key to ArrayList [duplicate]
I'm working on a Card game assignment and our lecturers want us to use different data structures. Now I have an ArrayList of Cards object and a HashMap of Points<Cards, Integer>. I'm trying to ...
1
vote
1
answer
52
views
How to understand the ArrayList<Map<String,Object>> in multi-layer loop, the ArrayList<Map<String,Object>> contents are the same?
when I use ArrayList<Map<String,Object>> in multi-layer loop, the ArrayList<Map<String,Object>> are weird.
import java.util.*;
public class Main {
public static void main(...
1
vote
1
answer
562
views
Displaying map in tabular format which has object as key and Arraylist as value in jsp
MapKey mapKey = new MapKey(reqId, name, status);
LinkedHashMap<Object, List<Dashboard>> map = new LinkedHashMap<>();
Mapkey Class:
public class MapKey {
private Integer ...
2
votes
1
answer
1k
views
Getting Hashmap in jsp
public class DBConnection {
public HashMap<Object, List<Dashboard>> getStoreResult() {
ArrayList<Dashboard> dashRec=new ArrayList<Dashboard>();
try{
Class....
0
votes
1
answer
358
views
Getting last row's data in the map
My objective is to create a map.
It have reqid,name and lowest status number of a set as a key.
Here set refers to rows belonging to a specific Reqid.
The value of the map is an Arraylist which ...
0
votes
3
answers
610
views
Add user defined object as key in hashmap
public class Dashboard {
int REQUEST_ID, PRICE;
String LOGIN_USER;
public int getREQUEST_ID() {
return REQUEST_ID;
}
public void setREQUEST_ID(int rEQUEST_ID) {
REQUEST_ID = rEQUEST_ID;
...
1
vote
2
answers
470
views
Get attributes value from sql database as user defined object in hashmap
public class Dashboard {
int REQUEST_ID, PRICE, PROCESSED;
String LOGIN_USER;
public int getREQUEST_ID() {
return REQUEST_ID;
}
public void setREQUEST_ID(int rEQUEST_ID) {
...
0
votes
2
answers
369
views
Thread-safe HashMap of Objects with Nested ArrayList
I have a HashMap of objects with nested ArrayLists that is accessed by multiple threads.
I am wondering if declaring it as a synchronized HashMap is enough to make it thread-safe.
public class ...
-5
votes
3
answers
553
views
How do I create ArrayList of Objects (string car model, int count, string percentage) in a loop?
So I need to create Object for example called Car containing
- String car model
- int count
- String percentage
After getting this data how do I put all Car Objects into for-loop of Objects to get ...
0
votes
2
answers
286
views
Iterating hashmap of arraylist of two different Class types
I have to create an hashmap of arraylist but arraylist can be of type StudentRecord or TeacherRecord(which are two different classes) I have added both the records but I am not able to iterate ...
1
vote
0
answers
71
views
How convert hashmap values containing object into JSON file and back to Objects in Java ?
The object that is stored in the hashmap, is a connector object that connects 2 other classes into one. One of this class has arraylist of another class.
How do I make this hashmap into a JSON object....
2
votes
2
answers
230
views
How to convert list of maps to list of objects if list of maps has extra keys
My question is almost similar to How to convert list of maps to list of objects.
But the problem is now, I have list of maps where maps contains some extra keys which is not present in my Pojo class ...
0
votes
2
answers
838
views
Java HashMap custom Object
Example:
d1 = "the sky is blue"
d2 = "the car is blue"
Key Value
the [<d1,1>,<d2,1>]
sky [<d1,1>]
is [<d1,1>,<d2,1>]
blue [...
2
votes
3
answers
3k
views
Storing objects of different classes inside an ArrayList
I have a abstract animal class and other subclass like reptiles which is further inherited.
I have created array to initialize the animal as shown below:
public void initializeArray()
{
zooAnimal ...
1
vote
1
answer
492
views
Inserting a text file into a Map<Integer, Map<Integer, Double>>
This is my first question here so please bear with me. I have a text file that looks like something like this;
userId,itemId,rating
1,101,2.5
4,103,3.0
1,103,3.0
6,104,3.5
2,101,3.0
4,106,4.5
2,103,1....