Problems finding median of arrayList
<p>I keep getting <code>The type of the expression must be an array type but it resolved to ArrayList&lt;Double&gt;</code> The arrayList is pulling numbers from my Test class. I made the if to determine if the arrayList has an even amount of values in it or an odd, for I could use the two different ways to determine the median. But I'm not able to get the median formula to work.</p>

<pre><code>public class Data {

private ArrayList&lt;Double&gt; sets;

public Data(double[] set) {
    this.sets = new ArrayList&lt;Double&gt;();
    for (double i : set) {
        this.sets.add(i);
    }
}

public double getMedian(){
    Collections.sort(sets);

    double middle = sets.size()/2;
        if (sets.size()%2 == 1) {
           middle = (sets[sets.size()/2] + sets[sets.size()/2 - 1])/2;
        } else {
            middle = sets[sets.size() / 2];
        }
      return middle;
}
</code></pre>