I have this class:
public class Offer {
private Integer id;
private String description;
private Double price;
private String currency;
private Date timeExpired;
public Offer(Integer id, String description, Double price, String currency, Date timeExpired){
this.id = id;
this.description = description;
this.price = price;
this.currency = currency;
this.timeExpired = timeExpired;
}
}
I want to create a hashmap with key that refers to id of the class Offer and value as Offer.
HashMap<id of Offer(?),Offer> repo = new HashMap<id of Offer(?),Offer>();
How can I do that?
How assign each Offer id as key and the Offer objects as values on Hashmap repo?
I mean method repo.put(?)