Consider the following class:
public class Cars extends Observable{
    private ArrayList<String> carList = new ArrayList<String>();
    public void addToCarList(String car){
        // ...
        hasChanged();
        notifyObservers();
    }
    public void removeFromCarList(String car){
        // ...
        hasChanged();
        notifyObservers();
    }
    public ArrayList<String> getCarList() {
        return carList;
    }    
}
As you can see, every time the carList is changed, I want to notify the Observers. 
If someone does getCarList().add(...);, this is circumvented. 
How can I give read access to the carList (for iterating over it etc.) but prevent write access to it except for the special methods  addToCarList and removeFromCarList? 
I thought about this:
public ArrayList<String> getCarList() {
    return (ArrayList<String>)carList.clone();
}
but someone using my class would, when adding something to the clone of carList, not be informed that that's not the way it's meant to be done. 
 
     
     
     
     
     
    