Java collection to store multiple types of data in key value pairs

I am currently working on creating a small framework using the executor and completion services to concurrently execute multiple tasks at the same time. I have another thread that runs independently which monitors the completion service and polls futures every 2 seconds to check for results. When a task fails, I would like to re execute it by submitting it back. I would like to retry up to 3 times. I now need a collection that can let me store the task ID, reference of the task object and the number of retries attempted which would be an integer while keeping the task ID as the unique key. Currently I am using 2 hash maps. One for storing the ID and reference and the other for storing the ID and retry count.

Edit My question is that I need suggestions for a collection that would let me store the 3 things by keeping task ID as the unique key to retrieve the task reference and the retry count more efficiently than 2 hash maps.

Answer:1

I need to implement a class in java where its field needs to be set only once, but it's value is not known at field declaration. To do so I have: public class MyClass { private String field1 = ...

I have a simple executable Jar file. How I can set icon for this file? In my case I use the standard Jar icon which I would like to change.

Is there a compiler optimization for the size() methods of Collections in Java? Consider the following code: for(int i=0;i<list.size();i++) ...some operation..... There is a call to ...

How to build the following PSQL query to update multiple records using jOOQ 3.10.x? UPDATE users SET name = s.name, city = s.city FROM users_staging s WHERE users.id = s.id;