Example usage for com.google.common.collect Maps filterValues

List of usage examples for com.google.common.collect Maps filterValues

Introduction

In this page you can find the example usage for com.google.common.collect Maps filterValues.

Prototype

@CheckReturnValue
public static <K, V> BiMap<K, V> filterValues(BiMap<K, V> unfiltered,
        final Predicate<? super V> valuePredicate) 

Source Link

Document

Returns a bimap containing the mappings in unfiltered whose values satisfy a predicate.

Usage

From source file:com.cloud.utils.Utils.java

public static <K, V> Map getImmutableMap(Map<K, V> map) {
    Map<K, V> filteredMap = Maps.filterValues(map, new Predicate<V>() {
        public boolean apply(final V input) {
            return input != null;
        }//  w w w . j  a  v a2s. c  o m
    });

    return ImmutableMap.<K, V>builder().putAll(filteredMap).build();
}

From source file:pkmntv.logic.TypeEffect.java

public static Map getNormalEffectMap() {
    return Maps.filterValues(TYPE_MAP, Predicates.equalTo(NORMAL_FACTOR));
}

From source file:pkmntv.logic.TypeEffect.java

public static Map getWeakEffectMap() {
    return Maps.filterValues(TYPE_MAP, Predicates.in(WEAK_FACTORS));
}

From source file:pkmntv.logic.TypeEffect.java

public static Map getImmuneEffectMap() {
    return Maps.filterValues(TYPE_MAP, Predicates.equalTo(IMMUNE_FACTOR));
}

From source file:pkmntv.logic.TypeEffect.java

public static Map getResistantEffectMap() {
    return Maps.filterValues(TYPE_MAP, Predicates.in(RESISTANCE_FACTORS));
}

From source file:com.facebook.presto.util.MapTransformer.java

public MapTransformer<K, V> filterValues(Predicate<? super V> predicate) {
    return new MapTransformer<>(Maps.filterValues(map, predicate));
}

From source file:eu.esdihumboldt.hale.common.lookup.impl.LookupTableImpl.java

/**
 * Create a new lookup table based on the given map.
 * /*w  ww .  jav a 2  s.  c om*/
 * @param table the lookup table map
 */
public LookupTableImpl(Map<Value, Value> table) {
    super();
    // ignore null values, so their entries don't show up in any methods
    this.table = new LinkedHashMap<Value, Value>(Maps.filterValues(table, Predicates.notNull()));
}

From source file:zotmc.collect.FluentMap.java

public FluentMap<K, V> filterValues(Predicate<? super V> valuePredicate) {
    return from(Maps.filterValues(delegatee(), valuePredicate));
}

From source file:org.parceler.internal.ResultTransformerProcessor.java

@Override
public Map<Provider<ASTType>, T> getResults() {
    return Maps.filterValues(Maps.transformValues(delegate.getResults(), function), new Predicate<T>() {
        @Override//from   ww  w .  ja  va  2 s . c om
        public boolean apply(@Nullable T t) {
            return t != null;
        }
    });
}

From source file:com.torodb.core.transaction.metainf.WrapperMutableMetaSnapshot.java

public WrapperMutableMetaSnapshot(ImmutableMetaSnapshot wrapped) {
    this.wrapped = wrapped;
    this.dbsByName = new HashMap<>();

    wrapped.streamMetaDatabases().forEach((db) -> {
        WrapperMutableMetaDatabase mutable = createMetaDatabase(db);
        dbsByName.put(db.getName(), new Tuple2<>(mutable, MetaElementState.NOT_CHANGED));
    });//from  w  w w.  j av  a 2 s .com
    aliveMap = Maps.filterValues(dbsByName, tuple -> tuple.v2().isAlive());
}