public int getNumberOfDice(Die die) { int number = 0; for (Die itemDie : dice) { if (itemDie.getType() == die.getType()) { number++; } } return number; }
public void setNumberOfDice(Die die, int number) { ItemDice tmpDice = new ItemDice(); for (Die d : dice) { if (d.getType() != die.getType()) { tmpDice.add(d); } } for (int i = 0; i < number; i++) { tmpDice.add(die); } dice = tmpDice; }