当前位置: 首页>>代码示例>>Java>>正文


Java Predicate类代码示例

本文整理汇总了Java中android.support.test.espresso.core.deps.guava.base.Predicate的典型用法代码示例。如果您正苦于以下问题:Java Predicate类的具体用法?Java Predicate怎么用?Java Predicate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Predicate类属于android.support.test.espresso.core.deps.guava.base包,在下文中一共展示了Predicate类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: containsWithValue

import android.support.test.espresso.core.deps.guava.base.Predicate; //导入依赖的package包/类
private Matcher<? super List<HttpHeaderValue>> containsWithValue(final String value) {
  return new CustomTypeSafeMatcher<List<HttpHeaderValue>>("contains with value:" + value) {
    @Override
    protected boolean matchesSafely(List<HttpHeaderValue> list) {
      return any(list, new Predicate<HttpHeaderValue>() {
        @Override
        public boolean apply(@Nullable HttpHeaderValue httpHeaderValue) {
          return httpHeaderValue.getValue().equals(value);
        }
      });
    }
  };
}
 
开发者ID:jainsahab,项目名称:AndroidSnooper,代码行数:14,代码来源:SnooperRepoTest.java

示例2: RelativeMatcher

import android.support.test.espresso.core.deps.guava.base.Predicate; //导入依赖的package包/类
private RelativeMatcher(Matcher<View> target, DoublePredicate<View> predicate, String description, Type type) {
    mTarget = target;
    mTargetPredicate = new Predicate<View>() {
        @Override
        public boolean apply(@Nullable View view) {
            return mTarget.matches(view);
        }
    };
    mPredicate = predicate;
    mDescription = description;
    mType = type;
}
 
开发者ID:DocuSignDev,项目名称:americano,代码行数:13,代码来源:RelativeMatcher.java

示例3: matchesSafely

import android.support.test.espresso.core.deps.guava.base.Predicate; //导入依赖的package包/类
@Override
public boolean matchesSafely(final View testView) {
    if (!mTargetPredicate.apply(testView))
        return false;

    Predicate<View> pred = new Predicate<View>() {
        @Override
        public boolean apply(@Nullable View targetView) {
            return mPredicate.apply(testView, targetView);
        }
    };
    Iterable<View> traversal = Iterables.filter(breadthFirstViewTraversal(testView.getRootView()), new Predicate<View>() {
        @Override
        public boolean apply(@Nullable View input) {
            return input != testView && mTargetPredicate.apply(input);
        }
    });
    if (Iterables.isEmpty(traversal)) {
        throw new NoMatchingViewException.Builder().withViewMatcher(mTarget).build(); // TODO: build an actual err msg
    }
    switch (mType) {
        case ANY:   return Iterables.any(traversal, pred);
        case ALL:   return Iterables.all(traversal, pred);
        case NONE:  return !Iterables.any(traversal, pred);
        default:    throw new IllegalStateException("impossible mType");
    }
}
 
开发者ID:DocuSignDev,项目名称:americano,代码行数:28,代码来源:RelativeMatcher.java


注:本文中的android.support.test.espresso.core.deps.guava.base.Predicate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。