Skip to content

Commit

Permalink
Merge pull request #1057 from zsxwing/issue-1044
Browse files Browse the repository at this point in the history
Fix issue #1044
  • Loading branch information
benjchristensen committed Apr 21, 2014
2 parents fb46392 + f959dfd commit 315a994
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ class RxScalaDemo extends JUnitSuite {

@Test def elementAtExample(): Unit = {
val o = List("red", "green", "blue").toObservable
println(o(2).toBlockingObservable.single)
println(o.elementAt(2).toBlockingObservable.single)
}

@Test def elementAtOrDefaultExample(): Unit = {
Expand Down Expand Up @@ -609,4 +609,14 @@ class RxScalaDemo extends JUnitSuite {
val m = o.toMap(keySelector, valueSelector, mapFactory)
println(m.toBlockingObservable.single)
}

@Test def retryExample1(): Unit = {
val o : Observable[String] = List("alice", "bob", "carol").toObservable
assertEquals(List("alice", "bob", "carol"), o.retry.toBlockingObservable.toList)
}

@Test def retryExample2(): Unit = {
val o : Observable[String] = List("alice", "bob", "carol").toObservable
assertEquals(List("alice", "bob", "carol"), o.retry(3).toBlockingObservable.toList)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,7 @@ trait Observable[+T]
* emits [1, 2, 3, 4, 5] then the complete output would be [1, 2, 1, 2, 3, 4, 5, onCompleted].
* @return Observable with retry logic.
*/
def retry: Observable[T] = {
def retry(): Observable[T] = {
toScalaObservable[T](asJavaObservable.retry())
}

Expand Down Expand Up @@ -2350,6 +2350,7 @@ trait Observable[+T]
* @throws IndexOutOfBoundsException
* if index is less than 0
* @see `Observable.elementAt`
* @deprecated("Use `elementAt`", "0.18.0")
*/
def apply(index: Int): Observable[T] = elementAt(index)

Expand Down

0 comments on commit 315a994

Please sign in to comment.