1

I want to use observer and observable in Java 13, but they are deprecated, is there any other way to use those classes?

  • https://stackoverflow.com/a/46381645/2478398 – BeUndead Feb 15 '20 at 18:16
  • Per the Observable API: "This class and the Observer interface have been deprecated. The event model supported by Observer and Observable is quite limited, the order of notifications delivered by Observable is unspecified, and state changes are not in one-for-one correspondence with notifications. For a richer event model, consider using the java.beans package. For reliable and ordered messaging among threads, consider using one of the concurrent data structures in the java.util.concurrent package. For reactive streams style programming, see the Flow API." – Hovercraft Full Of Eels Feb 15 '20 at 18:29
  • So in short, best *not* to use Observer and Observable lest your code run into future trouble. Best to use one of the alternatives suggested to keep your code safe. – Hovercraft Full Of Eels Feb 15 '20 at 18:32

0 Answers0