Module id.xfunction
Package id.xfunction

Class XObservable<T>

Object
XObservable<T>

public class XObservable<T> extends Object
Allows you to register to the objects which will send you notification once something has changed. Performs single threaded simple notification.

Java deprecated Observable since Java 9. The alternatives they propose are:

  • javabeans - requires you to add dependency on java.desktop
  • flow - requires you to define onComplete and others
  • java.util.concurrent - for messaging between the threads

Which may be not exactly what you need if you are looking for simple notification in non GUI application.

  • Constructor Details

    • XObservable

      public XObservable()
  • Method Details

    • addListener

      public void addListener(Consumer<T> listener)
    • removeListener

      public void removeListener(Consumer<T> listener)
    • updateAll

      public void updateAll(T val)