本文整理了Java中com.google.common.collect.Maps.valuePredicateOnEntries()
方法的一些代码示例,展示了Maps.valuePredicateOnEntries()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Maps.valuePredicateOnEntries()
方法的具体详情如下:
包路径:com.google.common.collect.Maps
类名称:Maps
方法名:valuePredicateOnEntries
暂无
代码示例来源:origin: google/guava
@Override
public boolean retainAll(Collection<?> c) {
return Iterables.removeIf(
multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(
multimap.entryPredicate(),
Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c)))));
}
代码示例来源:origin: google/guava
/**
* Returns a map containing the mappings in {@code unfiltered} whose values satisfy a predicate.
* The returned map is a live view of {@code unfiltered}; changes to one affect the other.
*
* <p>The resulting map'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 map
* and its views. When given a value that doesn't satisfy the predicate, the map's {@code put()},
* {@code putAll()}, and {@link Entry#setValue} methods throw an {@link IllegalArgumentException}.
*
* <p>When methods such as {@code removeAll()} and {@code clear()} are called on the filtered map
* or its views, only mappings whose values satisfy the filter will be removed from the underlying
* map.
*
* <p>The returned map isn't threadsafe or serializable, even if {@code unfiltered} is.
*
* <p>Many of the filtered map's methods, such as {@code size()}, iterate across every key/value
* mapping in the underlying map and determine which satisfy the filter. When a live view is
* <i>not</i> needed, it may be faster to copy the filtered map and use the copy.
*
* <p><b>Warning:</b> {@code valuePredicate} must be <i>consistent with equals</i>, as documented
* at {@link Predicate#apply}. Do not provide a predicate such as {@code
* Predicates.instanceOf(ArrayList.class)}, which is inconsistent with equals.
*/
public static <K, V> Map<K, V> filterValues(
Map<K, V> unfiltered, final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
}
代码示例来源:origin: google/guava
@Override
public boolean removeAll(Collection<?> c) {
return Iterables.removeIf(
multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(
multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.in(c))));
}
代码示例来源:origin: google/guava
/**
* Returns a sorted map containing the mappings in {@code unfiltered} whose values satisfy a
* predicate. The returned map is a live view of {@code unfiltered}; changes to one affect the
* other.
*
* <p>The resulting map'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 map
* and its views. When given a value that doesn't satisfy the predicate, the map's {@code put()},
* {@code putAll()}, and {@link Entry#setValue} methods throw an {@link IllegalArgumentException}.
*
* <p>When methods such as {@code removeAll()} and {@code clear()} are called on the filtered map
* or its views, only mappings whose values satisfy the filter will be removed from the underlying
* map.
*
* <p>The returned map isn't threadsafe or serializable, even if {@code unfiltered} is.
*
* <p>Many of the filtered map's methods, such as {@code size()}, iterate across every key/value
* mapping in the underlying map and determine which satisfy the filter. When a live view is
* <i>not</i> needed, it may be faster to copy the filtered map and use the copy.
*
* <p><b>Warning:</b> {@code valuePredicate} must be <i>consistent with equals</i>, as documented
* at {@link Predicate#apply}. Do not provide a predicate such as {@code
* Predicates.instanceOf(ArrayList.class)}, which is inconsistent with equals.
*
* @since 11.0
*/
public static <K, V> SortedMap<K, V> filterValues(
SortedMap<K, V> unfiltered, final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
}
代码示例来源:origin: google/guava
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: google/guava
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: google/guava
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: google/j2objc
@Override
public boolean retainAll(Collection<?> c) {
return Iterables.removeIf(
multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(
multimap.entryPredicate(),
Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c)))));
}
代码示例来源:origin: google/j2objc
@Override
public boolean removeAll(Collection<?> c) {
return Iterables.removeIf(
multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(
multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.in(c))));
}
代码示例来源:origin: google/guava
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: wildfly/wildfly
@Override
public boolean retainAll(Collection<?> c) {
return Iterables.removeIf(
multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(
multimap.entryPredicate(),
Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c)))));
}
代码示例来源:origin: wildfly/wildfly
@Override
public boolean removeAll(Collection<?> c) {
return Iterables.removeIf(
multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(
multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.in(c))));
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns a sorted map containing the mappings in {@code unfiltered} whose values satisfy a
* predicate. The returned map is a live view of {@code unfiltered}; changes to one affect the
* other.
*
* <p>The resulting map'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 map
* and its views. When given a value that doesn't satisfy the predicate, the map's {@code put()},
* {@code putAll()}, and {@link Entry#setValue} methods throw an {@link IllegalArgumentException}.
*
* <p>When methods such as {@code removeAll()} and {@code clear()} are called on the filtered map
* or its views, only mappings whose values satisfy the filter will be removed from the underlying
* map.
*
* <p>The returned map isn't threadsafe or serializable, even if {@code unfiltered} is.
*
* <p>Many of the filtered map's methods, such as {@code size()}, iterate across every key/value
* mapping in the underlying map and determine which satisfy the filter. When a live view is
* <i>not</i> needed, it may be faster to copy the filtered map and use the copy.
*
* <p><b>Warning:</b> {@code valuePredicate} must be <i>consistent with equals</i>, as documented
* at {@link Predicate#apply}. Do not provide a predicate such as {@code
* Predicates.instanceOf(ArrayList.class)}, which is inconsistent with equals.
*
* @since 11.0
*/
public static <K, V> SortedMap<K, V> filterValues(
SortedMap<K, V> unfiltered, final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
}
代码示例来源:origin: wildfly/wildfly
/**
* Returns a map containing the mappings in {@code unfiltered} whose values satisfy a predicate.
* The returned map is a live view of {@code unfiltered}; changes to one affect the other.
*
* <p>The resulting map'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 map
* and its views. When given a value that doesn't satisfy the predicate, the map's {@code put()},
* {@code putAll()}, and {@link Entry#setValue} methods throw an {@link IllegalArgumentException}.
*
* <p>When methods such as {@code removeAll()} and {@code clear()} are called on the filtered map
* or its views, only mappings whose values satisfy the filter will be removed from the underlying
* map.
*
* <p>The returned map isn't threadsafe or serializable, even if {@code unfiltered} is.
*
* <p>Many of the filtered map's methods, such as {@code size()}, iterate across every key/value
* mapping in the underlying map and determine which satisfy the filter. When a live view is
* <i>not</i> needed, it may be faster to copy the filtered map and use the copy.
*
* <p><b>Warning:</b> {@code valuePredicate} must be <i>consistent with equals</i>, as documented
* at {@link Predicate#apply}. Do not provide a predicate such as {@code
* Predicates.instanceOf(ArrayList.class)}, which is inconsistent with equals.
*/
public static <K, V> Map<K, V> filterValues(
Map<K, V> unfiltered, final Predicate<? super V> valuePredicate) {
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
}
代码示例来源:origin: wildfly/wildfly
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: wildfly/wildfly
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: wildfly/wildfly
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: wildfly/wildfly
return filterEntries(unfiltered, Maps.<V>valuePredicateOnEntries(valuePredicate));
代码示例来源:origin: com.diffplug.guava/guava-collect
private boolean removeIf(Predicate<? super V> valuePredicate) {
return Iterables.removeIf(
unfiltered.entrySet(),
Predicates.<Entry<K, V>> and(predicate, Maps.<V> valuePredicateOnEntries(valuePredicate)));
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava
@Override
public boolean removeAll(Collection<?> c) {
return Iterables.removeIf(multimap.unfiltered().entries(),
// explicit <Entry<K, V>> is required to build with JDK6
Predicates.<Entry<K, V>>and(multimap.entryPredicate(),
Maps.<V>valuePredicateOnEntries(Predicates.in(c))));
}
内容来源于网络,如有侵权,请联系作者删除!