Skip to content

Instantly share code, notes, and snippets.

@akarnokd
Created August 1, 2018 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akarnokd/c187983b43a795e9777ac58189b8bc24 to your computer and use it in GitHub Desktop.
Save akarnokd/c187983b43a795e9777ac58189b8bc24 to your computer and use it in GitHub Desktop.
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import io.reactivex.Observable;
public class SampleTest {
@Test
public void test() throws Exception {
Observable.interval(50, TimeUnit.MILLISECONDS)
.doOnNext(v -> {
if (v % 20 == 0) {
System.out.println("--------- second: " + v / 20);
}
})
.sample(200, TimeUnit.MILLISECONDS)
.subscribe(System.out::println);
Thread.sleep(5000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment