Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

What is Observable?

 
Ranch Hand
Posts: 344
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No offense intended.  I think Java has several fancy descriptions for everyday concepts. I cannot even say that the Javadoc is making the concepts easier to understand.
So, I see things like ObservableMap<Object,​Object> and I am wondering what is Observable in ObservableMap.
Grateful if anyone can break it down for me to comprehend.
 
Saloon Keeper
Posts: 12816
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a Map that's also Observable.

A map that allows observers to track changes when they occur.


An Observable is an entity that wraps content and allows to observe the content for invalidations.



What part are you having difficulties with?
 
Saloon Keeper
Posts: 6890
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is, I think, beyond dispute is that Observer and Observable are leftovers from Java's earliest days, and have long been replaced by other means like event listeners and (more recently) event buses.
 
Biniman Idugboe
Ranch Hand
Posts: 344
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

An Observable is an entity that wraps content and allows to observe the content for invalidations.


What does it allow?
 
Marshal
Posts: 26475
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was going to look it up in the API documentation, but it doesn't seem to be there. So, where is this ObservableMap class coming from?
 
Stephan van Hulst
Saloon Keeper
Posts: 12816
278
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:What is, I think, beyond dispute is that Observer and Observable are leftovers from Java's earliest days, and have long been replaced by other means like event listeners and (more recently) event buses.


The Observable we're talking about is from JavaFX.

Biniman Idugboe wrote:What does it allow?


You can add a listener to an Observable and it will be notified when the Observable's previous known state is no longer valid. For an ObservableMap this means you will get notified when an entry has been added or removed.
 
Paul Clapham
Marshal
Posts: 26475
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And here's the API documentation which says that: https://docs.oracle.com/javase/8/javafx/api/javafx/collections/ObservableMap.html
 
Tim Moores
Saloon Keeper
Posts: 6890
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The Observable we're talking about is from JavaFX.


I see. It would have been better to use a different name rather than one that was already in use in the JDK for a similar, although distinct purpose (even if that one is obsolete for all practical purposes), IMO.
 
The only thing that kept the leeches off of me was this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic