我有一个hashmap,其中键是UpgradePartType,而Value是一个 UpgradeParts列表。当EnginePart实现UpgradePart时,为什么我不能在Enginemap中放入EnginePart列表?
如果我把一个值为IUpgradePart的散列图当我放入EnginePart
时,它会起作用 private HashMap<UpgradePartType, ArrayList<IUpgradePart>> purchasedUpgrades;
...
purchasedUpgrades = new HashMap<UpgradePartType,ArrayList<IUpgradePart>>();
purchasedUpgrades.put(UpgradePartType.Engine,new ArrayList<EnginePart>());
...
public enum EnginePart implements IUpgradePart{
Stock,PortPolish,Bore,Tune
}
...
拥有空白界面也是正常的吗?我觉得这里应该有什么东西
public interface IUpgradePart{
}