com.google.common.collect.Maps.keyPredicateOnEntries()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(143)

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

Maps.keyPredicateOnEntries介绍

暂无

代码示例

代码示例来源:origin: google/guava

@Override
public Predicate<? super Entry<K, V>> entryPredicate() {
 return Maps.keyPredicateOnEntries(keyPredicate);
}

代码示例来源:origin: google/j2objc

@Override
public Predicate<? super Entry<K, V>> entryPredicate() {
 return Maps.keyPredicateOnEntries(keyPredicate);
}

代码示例来源:origin: wildfly/wildfly

@Override
public Predicate<? super Entry<K, V>> entryPredicate() {
 return Maps.keyPredicateOnEntries(keyPredicate);
}

代码示例来源:origin: google/guava

/**
 * Returns a bimap containing the mappings in {@code unfiltered} whose keys satisfy a predicate.
 * The returned bimap is a live view of {@code unfiltered}; changes to one affect the other.
 *
 * <p>The resulting bimap's {@code keySet()}, {@code entrySet()}, and {@code values()} views have
 * iterators that don't support {@code remove()}, but all other methods are supported by the bimap
 * and its views. When given a key that doesn't satisfy the predicate, the bimap's {@code put()},
 * {@code forcePut()} and {@code putAll()} methods throw an {@link IllegalArgumentException}.
 *
 * <p>When methods such as {@code removeAll()} and {@code clear()} are called on the filtered
 * bimap or its views, only mappings that satisfy the filter will be removed from the underlying
 * bimap.
 *
 * <p>The returned bimap isn't threadsafe or serializable, even if {@code unfiltered} is.
 *
 * <p>Many of the filtered bimap's methods, such as {@code size()}, iterate across every key in
 * the underlying bimap and determine which satisfy the filter. When a live view is <i>not</i>
 * needed, it may be faster to copy the filtered bimap and use the copy.
 *
 * <p><b>Warning:</b> {@code entryPredicate} must be <i>consistent with equals </i>, as documented
 * at {@link Predicate#apply}.
 *
 * @since 14.0
 */
public static <K, V> BiMap<K, V> filterKeys(
  BiMap<K, V> unfiltered, final Predicate<? super K> keyPredicate) {
 checkNotNull(keyPredicate);
 return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));
}

代码示例来源:origin: google/guava

return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));

代码示例来源:origin: google/guava

Map<K, V> unfiltered, final Predicate<? super K> keyPredicate) {
checkNotNull(keyPredicate);
Predicate<Entry<K, ?>> entryPredicate = keyPredicateOnEntries(keyPredicate);
return (unfiltered instanceof AbstractFilteredMap)
  ? filterFiltered((AbstractFilteredMap<K, V>) unfiltered, entryPredicate)

代码示例来源:origin: google/guava

return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));

代码示例来源:origin: wildfly/wildfly

/**
 * Returns a bimap containing the mappings in {@code unfiltered} whose keys satisfy a predicate.
 * The returned bimap is a live view of {@code unfiltered}; changes to one affect the other.
 *
 * <p>The resulting bimap's {@code keySet()}, {@code entrySet()}, and {@code values()} views have
 * iterators that don't support {@code remove()}, but all other methods are supported by the bimap
 * and its views. When given a key that doesn't satisfy the predicate, the bimap's {@code put()},
 * {@code forcePut()} and {@code putAll()} methods throw an {@link IllegalArgumentException}.
 *
 * <p>When methods such as {@code removeAll()} and {@code clear()} are called on the filtered
 * bimap or its views, only mappings that satisfy the filter will be removed from the underlying
 * bimap.
 *
 * <p>The returned bimap isn't threadsafe or serializable, even if {@code unfiltered} is.
 *
 * <p>Many of the filtered bimap's methods, such as {@code size()}, iterate across every key in
 * the underlying bimap and determine which satisfy the filter. When a live view is <i>not</i>
 * needed, it may be faster to copy the filtered bimap and use the copy.
 *
 * <p><b>Warning:</b> {@code entryPredicate} must be <i>consistent with equals </i>, as documented
 * at {@link Predicate#apply}.
 *
 * @since 14.0
 */
public static <K, V> BiMap<K, V> filterKeys(
  BiMap<K, V> unfiltered, final Predicate<? super K> keyPredicate) {
 checkNotNull(keyPredicate);
 return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));
}

代码示例来源:origin: wildfly/wildfly

return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));

代码示例来源:origin: wildfly/wildfly

Map<K, V> unfiltered, final Predicate<? super K> keyPredicate) {
checkNotNull(keyPredicate);
Predicate<Entry<K, ?>> entryPredicate = keyPredicateOnEntries(keyPredicate);
return (unfiltered instanceof AbstractFilteredMap)
  ? filterFiltered((AbstractFilteredMap<K, V>) unfiltered, entryPredicate)

代码示例来源:origin: google/guava

} else if (unfiltered instanceof FilteredSetMultimap) {
 FilteredSetMultimap<K, V> prev = (FilteredSetMultimap<K, V>) unfiltered;
 return filterFiltered(prev, Maps.<K>keyPredicateOnEntries(keyPredicate));
} else {
 return new FilteredKeySetMultimap<>(unfiltered, keyPredicate);

代码示例来源:origin: wildfly/wildfly

return filterEntries(unfiltered, Maps.<K>keyPredicateOnEntries(keyPredicate));

代码示例来源:origin: google/guava

} else if (unfiltered instanceof FilteredMultimap) {
 FilteredMultimap<K, V> prev = (FilteredMultimap<K, V>) unfiltered;
 return filterFiltered(prev, Maps.<K>keyPredicateOnEntries(keyPredicate));
} else {
 return new FilteredKeyMultimap<>(unfiltered, keyPredicate);

代码示例来源:origin: wildfly/wildfly

} else if (unfiltered instanceof FilteredSetMultimap) {
 FilteredSetMultimap<K, V> prev = (FilteredSetMultimap<K, V>) unfiltered;
 return filterFiltered(prev, Maps.<K>keyPredicateOnEntries(keyPredicate));
} else {
 return new FilteredKeySetMultimap<>(unfiltered, keyPredicate);

代码示例来源:origin: wildfly/wildfly

} else if (unfiltered instanceof FilteredMultimap) {
 FilteredMultimap<K, V> prev = (FilteredMultimap<K, V>) unfiltered;
 return filterFiltered(prev, Maps.<K>keyPredicateOnEntries(keyPredicate));
} else {
 return new FilteredKeyMultimap<>(unfiltered, keyPredicate);

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
 public boolean retainAll(Collection<?> c) {
  return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and(
    entryPredicate, Maps.<K>keyPredicateOnEntries(not(in(c)))));
 }
};

代码示例来源:origin: Nextdoor/bender

@Override
 public boolean retainAll(Collection<?> c) {
  return Iterators.removeIf(unfiltered.entrySet().iterator(), Predicates.<Entry<K, V>>and(
    entryPredicate, Maps.<K>keyPredicateOnEntries(not(in(c)))));
 }
};

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava

@Override
public boolean removeAll(Collection<?> c) {
 return Iterators.removeIf(unfiltered.entrySet().iterator(),
   Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(in(c))));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
public boolean removeAll(Collection<?> c) {
 return Iterators.removeIf(unfiltered.entrySet().iterator(),
   Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(in(c))));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public boolean removeAll(Collection<?> c) {
 return Iterators.removeIf(unfiltered.entrySet().iterator(),
   Predicates.<Entry<K, V>>and(entryPredicate, Maps.<K>keyPredicateOnEntries(in(c))));
}

相关文章