I'm not sure how I should check for duplicates in my arrayList. I want to return true or false in my output depending on whether or not the array contains duplicate numbers. The numbers are being pulled from another class.
public class Data {
private ArrayList<Double> sets;
public Data(double[] set) {
this.sets = new ArrayList<Double>();
for (double i : set) {
this.sets.add(i);
}
}
public double hasDuplicate(){
for (int i = 0; i < 6; i++) {
ArrayList<Double> sets = new ArrayList<Double>();
for (int j = 0; j < 6; j++)
sets.add(); //confused with this
}
}