Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dynamic list subscription and a list that tracks its elements #72

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

oowekyala
Copy link

So there's something that I needed and I think it can be useful in the main repository. Changelog:

  • Add LiveList#flattenVals: basically this can be viewed as a transformation ObservableList<Val<T>> -> LiveList<T>, it "flattens" the Val context into the list. I guess the transformation would be functionally equivalent to _.flatMap(LiveList::wrapVal)
    • The returned list observes the changes of its individual elements and outputs them as ListChanges.
    • Example use case:
LiveList<BlogEntry> entries = ...;

// the size property is now also updated when any BlogEntry.wasReadProperty() changes value
Val<Integer> readBlogs = entries.flattenVals(BlogEntry::wasReadProperty)
                                .filter(Boolean::booleanValue)
                                .sizeProperty();
  • The implementation needed implementing a dynamic subscription function for ObservableLists, which is in fact quite useful! I think that has the potential to e.g. simplify implementation of Implement ObservableList.flatMap #53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant