Ok so I have a problem thats slightly more complicated than the title suggests.
I have to write a method that randomly selects objects from one ArrayList and adds them to another ArrayList. The objects have an integer instance variable, "type" that is limited to 1-4. The second ArrayList should contain at least one element of each type. After that the objects can be selected at random until the second arraylist contains a number of objects determined by the user.
Can anyone suggest a relatively efficient way of doing this?
I cant think of any way that doesnt involve multiple additional arraylists.
P.S Sorry if I haven't phrased the problem particularly well, im a newbie to these forums