本文整理汇总了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());
}
示例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);
}
};
}
示例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));
}
示例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;
}
}
}
示例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));
}