I would like to define a class that has an ArrayList as one of its parameters. The entries of the ArrayList should be final. In my understanding, simply declaring the ArrayList attribute of the class as 'final' will not achieve this, because it just means that the reference to this list is final. How can I declare that the entries of the list are to be treated as 'final'?
public class MyClass{
private final ArrayList<Double> classAttributeWithFinalValues; // the entries of the list can still be changed
public MyClass(ArrayList<Double> classAttribute){
this.classAttributeWithFinalValues = classAttribute;
}
}