Why am I getting this error for this code? I have the correct imports for ArrayList an Collections
private ArrayList tips;
public TipsTask(ArrayLi
Collections.shuffle
shuffles the array in-place. This will be sufficient:
private ArrayList tips;
public TipsTask(ArrayList tips){
this.tips = tips;
Collections.shuffle(tips);
}
Or if you don't want the original list to change:
private ArrayList tips;
public TipsTask(ArrayList tips){
this.tips = new ArrayList(tips);
Collections.shuffle(this.tips);
}