tobiasdiez / EasyBind

Custom JavaFX bindings made easy with lambdas.
BSD 2-Clause "Simplified" License
30 stars 6 forks source link

Add stream interface for observable lists #19

Open tobiasdiez opened 4 years ago

tobiasdiez commented 4 years ago

Idea: Have an interface that works similar to List.stream() but takes updates into account.

Similar implementation: https://github.com/griffon/griffon/blob/development/subprojects/griffon-javafx/src/main/java/griffon/javafx/collections/ObservableStream.java

piegamesde commented 4 years ago

Is this something that requires some planning and careful implementation according to an interface? Or can we simply go ahead and add convenience methods to EasyObservableList inspired by this? (I'd really like EasyObservableList#map)

tobiasdiez commented 4 years ago

New convenient helper methods are always happily seen!

A proper stream-like interface is more work as one has to worry about chaining different operations. For the best performance, you don't want to create an intermediate list, and then listen to change events to this list; but you would like to listen to events of the original source and then transverse the stream-chain to only update the resulting list.

piegamesde commented 4 years ago

Ah, I see. So the difficulty does not lie in the API design, but in an efficient implementation. Thus, the methods can already be added with a naive implementation, and optimized afterwards?

tobiasdiez commented 4 years ago

Yes, exactly!