public void addObserver(Observer observer){
  if (observer == null) {
    throw new NullPointerException();
  }
synchronized (this) {
    if (!observers.contains(observer))     observers.add(observer);
  }
}

public void addObserver ( Observer observer ) { if ( observer == null ) { throw new NullPointerException ( ) ; } synchronized ( this ) { if ( ! observers . contains ( observer ) ) observers . add ( observer ) ; } }
adds the specified observer to the list of observers . if it is already registered , it is not added a second time .
