The Observable interface

The java.util.Observable interface implements the Observer pattern, which can be co-related here. However, all similarities end here. If we look at the Observable interface, we have the following methods:

public class Observable {  void addObserver (Observer o);  void deleteObserver (Observer o);  void deleteObservers();  void notifyObservers();  void notifyObserver(int arg);  int countObservers();  boolean hasChanged();}

Let's look at the Observer interface before we determine the differences:

public interface Observer{  void update(Observable o, Object arg)}

If we look at the Observable and Observer interfaces, we can see that they are all about a single event and its state. The Observable API has the responsibility of ...

Get Hands-On Reactive Programming with Reactor now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.