rx.Observable.skipWhile()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中rx.Observable.skipWhile()方法的一些代码示例,展示了Observable.skipWhile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Observable.skipWhile()方法的具体详情如下:
包路径:rx.Observable
类名称:Observable
方法名:skipWhile

Observable.skipWhile介绍

[英]Returns an Observable that skips all items emitted by the source Observable as long as a specified condition holds true, but emits all further source items as soon as the condition becomes false.

Scheduler: skipWhile does not operate by default on a particular Scheduler.
[中]返回一个Observable,只要指定的条件为true,它就会跳过源Observable发出的所有项,但一旦条件为false,它就会发出所有进一步的源项。
Scheduler:skipWhile默认情况下不会在特定的计划程序上运行。

代码示例

代码示例来源:origin: apache/usergrid

@Override
public Observable<FilterResult<Id>> call( final Observable<FilterResult<Id>> filterResultObservable ) {
  //filter only the first id, then map into our path for our next pass
  //skip our first and emit if neccessary
  return filterResultObservable.skipWhile( filterResult -> {
    final Optional<Id> startFromCursor = getSeekValue();
    return startFromCursor.isPresent() && startFromCursor.get().equals( filterResult.getValue() );
  } );
}

代码示例来源:origin: apache/usergrid

@Override
public Observable<FilterResult<Entity>> call( final Observable<FilterResult<Entity>> filterResultObservable ) {
  //filter only the first id, then map into our path for our next pass
  return filterResultObservable.skipWhile( filterResult -> {
    final Optional<Id> startFromCursor = getSeekValue();
    return startFromCursor.isPresent() && startFromCursor.get().equals( filterResult.getValue().getId() );
  } ).map( filterResult -> {
    final Entity entity = filterResult.getValue();
    final Id entityId = entity.getId();
    return createFilterResult( entity, entityId, filterResult.getPath() );
  } );
}

代码示例来源:origin: apache/usergrid

/**
 * Generate an observable for our appliation scope
 */
private Observable<ApplicationScope> getApplications( final Optional<EdgeScope> cursor,
                           final Optional<ApplicationScope> appId ) {
  //cursor is present use it and skip until we hit that app
  if (cursor.isPresent()) {
    final EdgeScope cursorValue = cursor.get();
    //we have a cursor and an application scope that was used.
    return allApplicationsObservable.getData().skipWhile(
      applicationScope -> !cursorValue.getApplicationScope().equals(applicationScope));
  }
  //this is intentional.  If
  else if (appId.isPresent()) {
    return Observable.just(appId.get())
      .doOnNext(appScope -> {
        //make sure index is initialized on rebuild
        entityIndexFactory.createEntityIndex(
          indexLocationStrategyFactory.getIndexLocationStrategy(appScope)
        ).initialize();
      });
  }
  return allApplicationsObservable.getData()
    .doOnNext(appScope -> {
      //make sure index is initialized on rebuild
      entityIndexFactory.createEntityIndex(
        indexLocationStrategyFactory.getIndexLocationStrategy(appScope)
      ).initialize();
    });
}

代码示例来源:origin: apache/usergrid

@Override
public Observable<FilterResult<ConnectionRef>> call(
  final Observable<FilterResult<ConnectionRef>> filterResultObservable ) {
  //filter only the first id, then map into our path for our next pass
  return filterResultObservable.skipWhile( filterResult -> {
    final Optional<Id> startFromCursor = getSeekValue();
    if ( !startFromCursor.isPresent() ) {
      return false;
    }
    final ConnectedEntityRef ref = filterResult.getValue().getTargetRefs();
    final Id entityId = startFromCursor.get();
    return entityId.getUuid().equals( ref.getUuid() ) && entityId.getType().equals( ref.getType() );
  } ).map( filterResult -> {
    final ConnectionRef entity = filterResult.getValue();
    final String type = entity.getTargetRefs().getType();
    final UUID uuid = entity.getTargetRefs().getUuid();
    final Id entityId = new SimpleId( uuid, type );
    return createFilterResult( entity, entityId, filterResult.getPath() );
  } );
}

代码示例来源:origin: apache/usergrid

.skipWhile( uniqueValue -> {

代码示例来源:origin: leeowenowen/rxjava-examples

@Override
 public void run() {
  Observable.range(1, 10).skipWhile(new Func1<Integer, Boolean>() {
   @Override
   public Boolean call(Integer i) {
    return i < 3;
   }
  }).subscribe(new Action1<Integer>() {
   @Override
   public void call(Integer integer) {
    log(integer);
   }
  });
 }
});

代码示例来源:origin: nurkiewicz/rxjava-book-examples

Observable<LocalDate> nextSolarEclipse(LocalDate after) {
  return Observable
      .just(
          LocalDate.of(2016, MARCH, 9),
          LocalDate.of(2016, SEPTEMBER, 1),
          LocalDate.of(2017, FEBRUARY, 26),
          LocalDate.of(2017, AUGUST, 21),
          LocalDate.of(2018, FEBRUARY, 15),
          LocalDate.of(2018, JULY, 13),
          LocalDate.of(2018, AUGUST, 11),
          LocalDate.of(2019, JANUARY, 6),
          LocalDate.of(2019, JULY, 2),
          LocalDate.of(2019, DECEMBER, 26))
      .skipWhile(date -> !date.isAfter(after))
      .zipWith(
          Observable.interval(500, 50, MILLISECONDS),
          (date, x) -> date);
}

代码示例来源:origin: com.couchbase.client/core-io

.skipWhile(new Func1<ObserveItem, Boolean>() {
  @Override
  public Boolean call(ObserveItem status) {

代码示例来源:origin: couchbase/couchbase-jvm-core

.skipWhile(new Func1<ObserveItem, Boolean>() {
  @Override
  public Boolean call(ObserveItem status) {

代码示例来源:origin: com.couchbase.client/core-io

.skipWhile(new Func1<ObserveItem, Boolean>() {
  @Override
  public Boolean call(ObserveItem status) {

代码示例来源:origin: couchbase/couchbase-jvm-core

.skipWhile(new Func1<ObserveItem, Boolean>() {
  @Override
  public Boolean call(ObserveItem status) {

相关文章

Observable类方法