My goal is to have an array like this: {{Object, int}, {Object, int}} where the integer represents a count of how many of the previously indicated object there are. I have looked into java generics, but I can't seem to get it right. What I have so far:
class AmmoRack < E extends Bullet, N > {
AmmoRack<Bullet, Integer>[][] ammo;
public AmmoRack() {
this( {new Bullet(Bullet.AP), 50});// Bullet.AP is an int, public Bullet(int type){...}
}
public AmmoRack(AmmoRack<Bullet, Integer>[][] ammo) {
this.ammo = ammo;
}
}
I have looked at other questions, but they didn't seem to be particularly helpful for my case.