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

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

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

Observable.isEmpty介绍

[英]Returns an Observable that emits true if the source Observable is empty, otherwise false.

In Rx.Net this is negated as the any Observer but we renamed this in RxJava to better match Java naming idioms.

Scheduler: isEmpty does not operate by default on a particular Scheduler.
[中]返回一个可观测值,如果源可观测值为空,则返回true,否则返回false。
在Rx。Net将其作为任何观察者进行否定,但我们在RxJava中对其进行了重命名,以更好地匹配Java命名习惯用法。
调度器:默认情况下,isEmpty不会在特定的调度器上运行。

代码示例

代码示例来源:origin: henrymorgen/android-advanced-light

private void isEmpty() {
  Observable.just(1,2,3).isEmpty().subscribe(new Action1<Boolean>() {
    @Override
    public void call(Boolean aBoolean) {
      Log.d(TAG, "isEmpty:"+aBoolean);
    }
  });
}

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

@Override
 public void run() {
  Observable.empty().isEmpty().subscribe(new Action1<Boolean>() {
   @Override
   public void call(Boolean aBoolean) {
    log(aBoolean);
   }
  });
 }
});

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

@Override
public Observable<Boolean> hasBucket(final String name) {
  return getBucket(name)
    .isEmpty()
    .map(new Func1<Boolean, Boolean>() {
      @Override
      public Boolean call(Boolean notFound) {
        return !notFound;
      }
    });
}

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

@Override
public Observable<DesignDocument> publishDesignDocument(final String name, final boolean overwrite) {
  return getDesignDocument(name, false)
      .onErrorResumeNext(new Func1<Throwable, Observable<? extends DesignDocument>>() {
        @Override
        public Observable<? extends DesignDocument> call(Throwable throwable) {
          if (throwable instanceof DesignDocumentDoesNotExistException) {
            return Observable.empty();
          } else {
            return Observable.error(throwable);
          }
        }
      }).isEmpty()
    .flatMap(new Func1<Boolean, Observable<DesignDocument>>() {
      @Override
      public Observable<DesignDocument> call(Boolean doesNotExist) {
        if (!doesNotExist && !overwrite) {
          return Observable.error(new DesignDocumentAlreadyExistsException("Document exists in " +
            "production and not overwriting."));
        }
        return getDesignDocument(name, true);
      }
    })
    .flatMap(new Func1<DesignDocument, Observable<DesignDocument>>() {
      @Override
      public Observable<DesignDocument> call(DesignDocument designDocument) {
        return upsertDesignDocument(designDocument);
      }
    });
}

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

@Override
public Observable<DesignDocument> insertDesignDocument(final DesignDocument designDocument, final boolean development) {
  return getDesignDocument(designDocument.name(), development)
    .onErrorResumeNext(new Func1<Throwable, Observable<? extends DesignDocument>>() {
      @Override
      public Observable<? extends DesignDocument> call(Throwable throwable) {
        if (throwable instanceof DesignDocumentDoesNotExistException) {
          return Observable.empty();
        } else {
          return Observable.error(throwable);
        }
      }
    }).isEmpty()
    .flatMap(new Func1<Boolean, Observable<DesignDocument>>() {
      @Override
      public Observable<DesignDocument> call(Boolean doesNotExist) {
        if (doesNotExist) {
          return upsertDesignDocument(designDocument, development);
        } else {
          return Observable.error(new DesignDocumentAlreadyExistsException());
        }
      }
    });
}

代码示例来源:origin: io.wcm.caravan/io.wcm.caravan.pipeline.impl

log.debug("Trying to retrieve document from cache level {} : {} : ", i, cacheAdapter.getClass().getSimpleName(), cacheKey);
result = cacheAdapter.get(cacheKey, options).cache();
if (!result.isEmpty().toBlocking().first()) {
 log.debug("Retrieved document from cache level {} : {} : {}", i, cacheAdapter.getClass().getSimpleName(), cacheKey);
 actualCacheAdapter = cacheAdapter;

代码示例来源:origin: it.unibo.alchemist/alchemist-enginedependentmodel

@Override
protected boolean isAllowed(final Position p) {
  return rtree.search(Geometries.point(p.getCoordinate(0), p.getCoordinate(1))).isEmpty().toBlocking().single();
}

代码示例来源:origin: yahoo/fili

observableResponse = preResponseObservable.isEmpty()
    .map(
        isEmptyResult -> handlePreResponse(

代码示例来源:origin: hawkular/hawkular-metrics

scheduledExecution.getJobDetails().getTrigger().getTriggerTime() >
        details.getTrigger().getTriggerTime())
.isEmpty()
.map(isEmpty -> {
  if (isEmpty) {

相关文章

Observable类方法