Skip to content

Commit a58b8fc

Browse files
committed
Update README.md
1 parent 7462d71 commit a58b8fc

1 file changed

Lines changed: 22 additions & 25 deletions

File tree

README.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -137,31 +137,28 @@ Subscription subscription = JavaFxObservable.fromObservableValueChanges(spinner.
137137
.subscribe(spinnerChangesLabel::setText);
138138
```
139139

140-
###ObservableList
141-
142-
There are eight factories in `JavaFxObservable` for turning an `ObservableList` into an `Observable` of some form based on a `ListChange` event.
143-
144-
```java
145-
public static <T> Observable<ObservableList<T>> fromObservableList(final ObservableList<T> source
146-
147-
public static <T> Observable<T> fromObservableListAdds(final ObservableList<T> source)
148-
149-
public static <T> Observable<T> fromObservableListRemovals(final ObservableList<T> source)
150-
151-
public static <T> Observable<T> fromObservableListUpdates(final ObservableList<T> source)
152-
153-
public static <T> Observable<ListChange<T>> fromObservableListChanges(final ObservableList<T> source)
154-
155-
public static <T> Observable<ListChange<T>> fromObservableListDistinctChanges(final ObservableList<T> source)
156-
157-
public static <T,R> Observable<ListChange<T>> fromObservableListDistinctChanges(final ObservableList<T> source, Func1<T,R> mapper)
158-
159-
public static <T,R> Observable<ListChange<R>> fromObservableListDistinctMappings(final ObservableList<T> source, Func1<T,R> mapper)
160-
```
161-
162-
The first factory`fromObservableList()` will simply emit the entire `ObservableList` every time there is `ListChange` event fired. The rest of the factories fire only items impacted by the `ListChange` events. The last three emit only *distinct* additions and removals, which can be helpful to emit only the first item with a given `hashcode()`/`equals()` and ignore dupe additions. When the last item (meaning no more dupes) is removed, only then will it fire the removal.
163-
164-
See the JavaDocs for a more detailed description of each one.
140+
###ObservableList, ObservableMap, and ObservableSet
141+
142+
There are several factories to emit many useful `ObservableList`, `ObservableMap`, and `ObservableSet` events as Observables. These all can be found as static factory methods in the `JavaFxObservable` static class.
143+
144+
145+
|Factory Method|Parameter Type|Return Type|Description|
146+
|---|---|---|
147+
|fromObservableList()|ObservableList&lt;T>|Observable&lt;ObservableList&lt;T>>|Emits the entire `ObservableList` every time it changes
148+
|fromObservableListAdds()|ObservableList&lt;T>|Observable&lt;T>|Emits additions to an `ObservableList`
149+
|fromfromObservableListRemovals()||ObservableList&lt;T>|Observable&lt;T>|Emits removals from an `ObservableList`
150+
|fromObservableListUpdates|ObservableList&lt;T>|Observable&lt;ListObservable&lt;ListChange&lt;T>>|Emits every item that was the result of a change to an `ObservableList`, with an `ADDED`, `REMOVED`, or `UPDATED` flag
151+
|fromObservableListDistinctChanges()|ObservableList&lt;T>| Observable&lt;ListChange&lt;R>>|Emits only *distinct* addtions and removals to an `ObservableList`
152+
|fromObservableListDistinctChanges()|ObservableList&lt;T>, Func1&lt;T,R>| Observable&lt;ListChange&lt;R>>|Emits only *distinct* additions and removals to an `ObservableList` and emits the mapping
153+
|fromObservableListDistinctChanges()|ObservableList&lt;T>, Func1&lt;T,R>| Observable&lt;ListChange&lt;R>>|Emits only *distinct* additions and removals to an `ObservableList` based on a mapping
154+
|fromObservableMap()|ObservableMap&lt;K,T>|Observable&lt;ObservableMap&lt;K,T>>|Emits the entire `ObservableMap` every time it changes
155+
|fromObservableMapAdds()|ObservableMap&lt;K,T>|Observable&lt;Map.Entry&lt;K,T>>|Emits every `Map.Entry<K,T>` added to an `ObservableMap`
156+
|fromObservableMapRemovals()|ObservableMap&lt;K,T>|Observable&lt;Map.Entry&lt;K,T>>|Emits every `Map.Entry<K,T>` removed from an `ObservableMap`
157+
|fromObservableMapChanges()|ObservableMap&lt;K,T>|Observable&lt;MapChange&lt;K,T>>|Emits every key/value pair with an `ADDED` or `REMOVED` flag.
158+
|fromObservableSet()|ObservableSet&lt;T>|Observable&lt;ObservableSet&lt;T>>|Emits the entire `ObservableSet` every time it changes
159+
|fromObservableSetAdds()|ObservableSet&lt;T>|Observable&lt;T>|Emits every addition to an `ObservableSet`
160+
|fromObservableSetRemovals()|ObservableSet&lt;T>|Observable&lt;T>|Emits every removal to an `ObservableSet`
161+
|fromObservableSetChanges()|ObservableSet&lt;T>|Observable&lt;SetChange&lt;T>|Emits every item `ADDED` or `REMOVED` item from an `ObservableSet` with the corresponding flag
165162

166163
###Binding
167164
You can convert an RxJava `Observable` into a JavaFX `Binding` by calling the `JavaFxSubscriber.toBinding()` factory. Calling the `dispose()` method on the `Binding` will handle the unsubscription from the `Observable`. You can then take this `Binding` to bind other control properties to it.

0 commit comments

Comments
 (0)