Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Set help...

So, what I'm trying to do in this nippet of code is make an Integer set that is equal to [b]nums[/b](another integer set) WITHOUT it changing [b]nums[/b]. For some reason, [b]nums[/b] always gets changed during these lines of code. How can I make this code NOT modify the [b]nums[/b] variable? I'm really stuck here.

[code]Random randomNumberGenerator = new Random(); ]
Set numsCopy = nums;
while (numsCopy.size() < 16){
int randomIndex = randomNumberGenerator.nextInt(31);
numsCopy.add(randomIndex);
}
String stringArray = numsCopy.toString();[/code]
Sign In or Register to comment.