Skip to main content

All Questions

Tagged with
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 ...
Mainaqisyah's user avatar
1 vote
1 answer
51 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(...
Helin's user avatar
  • 65
1 vote
1 answer
545 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 ...
Beginner's user avatar
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....
Beginner's user avatar
0 votes
1 answer
348 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 ...
Beginner's user avatar
0 votes
3 answers
533 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; ...
Aziz's user avatar
  • 23
1 vote
2 answers
446 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) { ...
Aziz's user avatar
  • 23
0 votes
2 answers
362 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 ...
gzuniga's user avatar
  • 23
-5 votes
3 answers
473 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 ...
George Constanza's user avatar
0 votes
2 answers
285 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 ...
kamalpreet kaur's user avatar
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....
Andrew Joeshanth's user avatar
2 votes
2 answers
229 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 ...
Saurabh Gaur's user avatar
  • 23.7k
0 votes
2 answers
836 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 [...
Leandro Campos's user avatar
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 ...
gp el's user avatar
  • 321
1 vote
1 answer
491 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....
Quincy Leito's user avatar

15 30 50 per page