Skip to content

Commit 4787adf

Browse files
Skip the empty Set being emitted
This is unnecessary and unexpected so skipping it.
1 parent ac75ded commit 4787adf

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

rxjava-contrib/rxjava-swing/src/main/java/rx/swing/sources/KeyEventSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public Boolean call(KeyEvent event) {
9999
}
100100
});
101101

102-
return filteredKeyEvents.scan(Collections.<Integer>emptySet(), new CollectKeys());
102+
return filteredKeyEvents.scan(Collections.<Integer>emptySet(), new CollectKeys()).skip(1);
103103
}
104104

105105
}

rxjava-contrib/rxjava-swing/src/test/java/rx/swing/sources/KeyEventSourceTest.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ public void call() {
9696

9797
InOrder inOrder = inOrder(action);
9898
fireKeyEvent(keyEvent(1, KeyEvent.KEY_PRESSED));
99-
// we receive an empty event at the beginning due to behavior of scan with an initial value
100-
inOrder.verify(action, times(1)).call(
101-
Collections.<Integer> emptySet());
10299
inOrder.verify(action, times(1)).call(
103100
new HashSet<Integer>(asList(1)));
104101
verify(error, never()).call(Matchers.<Throwable> any());

0 commit comments

Comments
 (0)