@@ -1231,6 +1231,35 @@ trait Observable[+T]
1231
1231
toScalaObservable[T ](asJavaObservable.skip(n))
1232
1232
}
1233
1233
1234
+ /**
1235
+ * Returns an Observable that drops values emitted by the source Observable before a specified time window
1236
+ * elapses.
1237
+ *
1238
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/skip.t.png">
1239
+ *
1240
+ * @param time the length of the time window to drop
1241
+ * @return an Observable that drops values emitted by the source Observable before the time window defined
1242
+ * by `time` elapses and emits the remainder
1243
+ */
1244
+ def drop (time : Duration ): Observable [T ] = {
1245
+ toScalaObservable(asJavaObservable.skip(time.length, time.unit))
1246
+ }
1247
+
1248
+ /**
1249
+ * Returns an Observable that drops values emitted by the source Observable before a specified time window
1250
+ * elapses.
1251
+ *
1252
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/skip.t.png">
1253
+ *
1254
+ * @param time the length of the time window to drop
1255
+ * @param scheduler the `Scheduler` on which the timed wait happens
1256
+ * @return an Observable that drops values emitted by the source Observable before the time window defined
1257
+ * by `time` elapses and emits the remainder
1258
+ */
1259
+ def drop (time : Duration , scheduler : Scheduler ): Observable [T ] = {
1260
+ toScalaObservable(asJavaObservable.skip(time.length, time.unit, scheduler))
1261
+ }
1262
+
1234
1263
/**
1235
1264
* Returns an Observable that bypasses all items from the source Observable as long as the specified
1236
1265
* condition holds true. Emits all further source items as soon as the condition becomes false.
@@ -1246,6 +1275,58 @@ trait Observable[+T]
1246
1275
toScalaObservable(asJavaObservable.skipWhile(predicate))
1247
1276
}
1248
1277
1278
+ /**
1279
+ * Returns an Observable that drops a specified number of items from the end of the sequence emitted by the
1280
+ * source Observable.
1281
+ * <p>
1282
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/skipLast.png">
1283
+ * <p>
1284
+ * This Observer accumulates a queue long enough to store the first `n` items. As more items are
1285
+ * received, items are taken from the front of the queue and emitted by the returned Observable. This causes
1286
+ * such items to be delayed.
1287
+ *
1288
+ * @param n number of items to drop from the end of the source sequence
1289
+ * @return an Observable that emits the items emitted by the source Observable except for the dropped ones
1290
+ * at the end
1291
+ * @throws IndexOutOfBoundsException if `n` is less than zero
1292
+ */
1293
+ def dropRight (n : Int ): Observable [T ] = {
1294
+ toScalaObservable(asJavaObservable.skipLast(n))
1295
+ }
1296
+
1297
+ /**
1298
+ * Returns an Observable that drops items emitted by the source Observable during a specified time window
1299
+ * before the source completes.
1300
+ * <p>
1301
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/skipLast.t.png">
1302
+ *
1303
+ * Note: this action will cache all items until "onCompleted" arrives. So don't use it on an infinite Observable.
1304
+ *
1305
+ * @param time the length of the time window
1306
+ * @return an Observable that drops those items emitted by the source Observable in a time window before the
1307
+ * source completes defined by `time`
1308
+ */
1309
+ def dropRight (time : Duration ): Observable [T ] = {
1310
+ toScalaObservable(asJavaObservable.skipLast(time.length, time.unit))
1311
+ }
1312
+
1313
+ /**
1314
+ * Returns an Observable that drops items emitted by the source Observable during a specified time window
1315
+ * (defined on a specified scheduler) before the source completes.
1316
+ * <p>
1317
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/skipLast.ts.png">
1318
+ *
1319
+ * Note: this action will cache all items until "onCompleted" arrives. So don't use it on an infinite Observable.
1320
+ *
1321
+ * @param time the length of the time window
1322
+ * @param scheduler the scheduler used as the time source
1323
+ * @return an Observable that drops those items emitted by the source Observable in a time window before the
1324
+ * source completes defined by `time` and `scheduler`
1325
+ */
1326
+ def dropRight (time : Duration , scheduler : Scheduler ): Observable [T ] = {
1327
+ toScalaObservable(asJavaObservable.skipLast(time.length, time.unit, scheduler))
1328
+ }
1329
+
1249
1330
/**
1250
1331
* Returns an Observable that emits only the first `num` items emitted by the source
1251
1332
* Observable.
0 commit comments