Set help... - Programmers Heaven

Howdy, Stranger!

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


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Set help...

idungotnosnidungotnosn Posts: 1Member
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);
String stringArray = numsCopy.toString();[/code]
Sign In or Register to comment.