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


Java Predicates.not方法代码示例

本文整理汇总了Java中com.google.common.base.Predicates.not方法的典型用法代码示例。如果您正苦于以下问题:Java Predicates.not方法的具体用法?Java Predicates.not怎么用?Java Predicates.not使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.base.Predicates的用法示例。


在下文中一共展示了Predicates.not方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SimpleHelpMap

import com.google.common.base.Predicates; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public SimpleHelpMap(CraftServer server) {
    this.helpTopics = new TreeMap<String, HelpTopic>(HelpTopicComparator.topicNameComparatorInstance()); // Using a TreeMap for its explicit sorting on key
    this.topicFactoryMap = new HashMap<Class, HelpTopicFactory<Command>>();
    this.server = server;
    this.yaml = new HelpYamlReader(server);

    Predicate indexFilter = Predicates.not(Predicates.instanceOf(CommandAliasHelpTopic.class));
    if (!yaml.commandTopicsInMasterIndex()) {
        indexFilter = Predicates.and(indexFilter, Predicates.not(new IsCommandTopicPredicate()));
    }

    this.defaultTopic = new IndexHelpTopic("Index", null, null, Collections2.filter(helpTopics.values(), indexFilter), "Use /help [n] to get page n of help.");

    registerHelpTopicFactory(MultipleCommandAlias.class, new MultipleCommandAliasHelpTopicFactory());
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:SimpleHelpMap.java

示例2: difference

import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
 * Returns an unmodifiable <b>view</b> of the difference of two sets. The
 * returned set contains all elements that are contained by {@code set1} and
 * not contained by {@code set2}. {@code set2} may also contain elements not
 * present in {@code set1}; these are simply ignored. The iteration order of
 * the returned set matches that of {@code set1}.
 *
 * <p>Results are undefined if {@code set1} and {@code set2} are sets based
 * on different equivalence relations (as {@code HashSet}, {@code TreeSet},
 * and the keySet of an {@code IdentityHashMap} all are).
 */
public static <E> SetView<E> difference(final Set<E> set1, final Set<?> set2) {
  checkNotNull(set1, "set1");
  checkNotNull(set2, "set2");

  final Predicate<Object> notInSet2 = Predicates.not(Predicates.in(set2));
  return new SetView<E>() {
    @Override
    public UnmodifiableIterator<E> iterator() {
      return Iterators.filter(set1.iterator(), notInSet2);
    }

    @Override
    public Stream<E> stream() {
      return set1.stream().filter(notInSet2);
    }

    @Override
    public Stream<E> parallelStream() {
      return set1.parallelStream().filter(notInSet2);
    }

    @Override
    public int size() {
      return Iterators.size(iterator());
    }

    @Override
    public boolean isEmpty() {
      return set2.containsAll(set1);
    }

    @Override
    public boolean contains(Object element) {
      return set1.contains(element) && !set2.contains(element);
    }
  };
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:49,代码来源:Sets.java

示例3: satisfies

import com.google.common.base.Predicates; //导入方法依赖的package包/类
public void satisfies(Predicate<? super T> predicate) {
  if (negate) {
    predicate = Predicates.not(predicate);
  }
  verifyUsingMatcher(predicate.apply(actualValue), Is.is(true));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:ObjectChecker.java

示例4: getPredicate

import com.google.common.base.Predicates; //导入方法依赖的package包/类
public Predicate<IBlockState> getPredicate(BlockStateContainer blockState)
{
    final IProperty<?> iproperty = blockState.getProperty(this.key);

    if (iproperty == null)
    {
        throw new RuntimeException(this.toString() + ": Definition: " + blockState + " has no property: " + this.key);
    }
    else
    {
        String s = this.value;
        boolean flag = !s.isEmpty() && s.charAt(0) == 33;

        if (flag)
        {
            s = s.substring(1);
        }

        List<String> list = SPLITTER.splitToList(s);

        if (list.isEmpty())
        {
            throw new RuntimeException(this.toString() + ": has an empty value: " + this.value);
        }
        else
        {
            Predicate<IBlockState> predicate;

            if (list.size() == 1)
            {
                predicate = this.makePredicate(iproperty, s);
            }
            else
            {
                predicate = Predicates.or(Iterables.transform(list, new Function<String, Predicate<IBlockState>>()
                {
                    @Nullable
                    public Predicate<IBlockState> apply(@Nullable String p_apply_1_)
                    {
                        return ConditionPropertyValue.this.makePredicate(iproperty, p_apply_1_);
                    }
                }));
            }

            return flag ? Predicates.not(predicate) : predicate;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:49,代码来源:ConditionPropertyValue.java

示例5: not

import com.google.common.base.Predicates; //导入方法依赖的package包/类
/**
 * Sugar for negating the predicate with type-safety.
 *
 * @param predicate
 *            the predicate to negate.
 * @return the negated predicate.
 */
public static ProjectTypePredicate not(ProjectTypePredicate predicate) {
	return new ProjectTypePredicate(Predicates.not(predicate));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:ProjectTypePredicate.java


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