i want to cast a hashmap :
my code:
public class Example {
private HashMap<MyItem, Integer> items =new HashMap<MyItem, Integer>();
@Override
public Map<Item, Integer> gItems() {
return this.items;
}
}
MyItem is a class who inherit from Item class.
this code give me a compilation error.
For manay reason i can't use the solution to change the type of the return method.
So how can i cast my HashMap<MyItem, Integer>
TO a Map<Item, Integer>
The error i'm getting is:
Type mismatch:cannot convert from HashMap<MyItem, Integer>
to Map<Item, Integer>
and the compilator ask me to change the type of return method.
Thank you.