public class Depot extends Item2
{
}
public class Station extends Item2
{
}
private final HashMap<Integer, Depot> depots = new HashMap<>();
private final HashMap<Integer, Station> stations = new HashMap<>();
both depots and stations stores something which has Item2 base. Now I want to pass to a function those:
Item2 item;
canBeAdded(item, depots);
canBeAdded(item, stations);
private boolean canBeAdded (Item2 item, HashMap<Integer, Item2> items)
{
sadly its not good, at canBeAdded it says 
"Incompatible types:
HashMap <Integer, Depot>cannot be converted to<Integer, Item2>"
 
     
     
    