Skip to content

Commit 537fffd

Browse files
authored
Merge pull request #62 from JordanMartinez/nonNullValues
Added convenience method: non-null values of Val
2 parents b0fa941 + 8aa339a commit 537fffd

File tree

1 file changed

+9
-0
lines changed
  • reactfx/src/main/java/org/reactfx/value

1 file changed

+9
-0
lines changed

reactfx/src/main/java/org/reactfx/value/Val.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ default EventStream<T> values() {
123123
return EventStreams.valuesOf(this);
124124
}
125125

126+
/**
127+
* Returns a stream of non-null values of this {@linkplain Val}. The returned stream
128+
* emits the current value of this {@linkplain Val} if it is not null for each new subscriber
129+
* and then the new value if it is not null whenever the value changes.
130+
*/
131+
default EventStream<T> nonNullValues() {
132+
return EventStreams.nonNullValuesOf(this);
133+
}
134+
126135
/**
127136
* Checks whether this {@linkplain Val} holds a (non-null) value.
128137
* @return {@code true} if this {@linkplain Val} holds a (non-null) value,

0 commit comments

Comments
 (0)