I'm writing a program that has an ImageView'sArraylist. I am using the .get() to take a dice imageview out from one arraylist and I add it to another Arraylist that is going to show all the dice that get chosen. I'm confused because does using the .get() remove it from the original Arraylist?
ArrayList<ImageView> rolledhand=new ArrayList<>(5);
Random rand = new Random();
for(int i=0;i<5;i++)
{
int randomNum = rand.nextInt(6);
rolledhand.add(diceingame.get(randomNum));
}
VBox diceRolled1=new VBox(rolledhand.get(0));
VBox diceRolled2=new VBox(rolledhand.get(0));
In my code above, the diceingame ArrayList already has 6 image view dice added to it. I randomly choose one and add it to my rolledhand array list 5 times. When I try to output the same index of rolledhand, only one shows up on my scene, not two of the same.
I'm not trying to remove it. I'm just asking because for some reason my program won't show both dice if they are from the same position in diceingame.