I would like to know if is it possible to create an object of class with two parameters. Indeed, I want two store two values (double, int) with the same key in my hashmap as this:
{1 = (4.0, 5),.... }
So, I did something like that but I do not how to get the resultat above:
public class Dijkstra{
private final List<Integer> L;
private final int V;
private final int P;
private final double C;
public Dijkstra(){
L = new ArrayList<>();
}
//Create my object to put after in my hashmap
public Dijkstra(int P, double C){
this.P = P;
this.C = C;
}
.....
public Map mymethod() {
Map<Integer, Object> m = new HashMap<Integer, Object>();
}
}
So, I want to create an object of my class with my two parameters to put it in my hashmap. How can I do this in java?
Thank you.