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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.