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

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

Introduction

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

Prototype

@GwtIncompatible("NavigableMap")
public static <K, V1, V2> NavigableMap<K, V2> transformValues(NavigableMap<K, V1> fromMap,
        Function<? super V1, V2> function) 

Source Link

Document

Returns a view of a navigable map where each value is transformed by a function.

Usage

From source file:org.androidtransfuse.analysis.astAnalyzer.validation.AnnotationValidatorBuilder.java

public AnnotationValidator build() {

    ImmutableMap<ASTType, Set<AnnotationValidator>> annotationValidators = ImmutableMap
            .copyOf(Maps.transformValues(givenMap,
                    new Function<Set<GivenAnnotationValidationBuilder>, Set<AnnotationValidator>>() {
                        @Override
                        public Set<AnnotationValidator> apply(Set<GivenAnnotationValidationBuilder> input) {
                            ImmutableSet.Builder<AnnotationValidator> validationSetBuilder = ImmutableSet
                                    .builder();

                            for (GivenAnnotationValidationBuilder givenAnnotationValidationBuilder : input) {
                                validationSetBuilder.add(givenAnnotationValidationBuilder.build());
                            }//from  www .  ja v a  2s.com

                            return validationSetBuilder.build();
                        }
                    }));

    return new MultiAnnotationValidator(annotationValidators);
}

From source file:zotmc.collect.FluentMap.java

public <W> FluentMap<K, W> transformValues(Function<? super V, W> function) {
    return from(Maps.transformValues(delegatee(), function));
}

From source file:org.agorava.core.utils.URLUtils.java

private static String doFormUrlEncode(Map<String, ?> params) {
    Map<String, String> urlEncodeMap = Maps.transformValues(params, new formUrlEncodeFunc());
    return queryMapJoiner.join(urlEncodeMap);
}

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  va2 s  .c  o m
        public boolean apply(@Nullable T t) {
            return t != null;
        }
    });
}

From source file:com.facebook.buck.distributed.DistBuildCellIndexer.java

private static BuildJobStateBuckConfig dumpConfig(BuckConfig buckConfig) {
    BuildJobStateBuckConfig jobState = new BuildJobStateBuckConfig();

    jobState.setUserEnvironment(buckConfig.getEnvironment());
    Map<String, List<OrderedStringMapEntry>> rawConfig = Maps
            .transformValues(buckConfig.getRawConfigForDistBuild(), input -> {
                List<OrderedStringMapEntry> result = new ArrayList<>();
                for (Map.Entry<String, String> entry : input.entrySet()) {
                    result.add(new OrderedStringMapEntry(entry.getKey(), entry.getValue()));
                }//w w w . j  a  va  2s . c o  m
                return result;
            });
    jobState.setRawBuckConfig(rawConfig);
    jobState.setArchitecture(buckConfig.getArchitecture().name());
    jobState.setPlatform(buckConfig.getPlatform().name());

    return jobState;
}

From source file:com.cloudera.exhibit.core.simple.SimpleExhibit.java

@Override
public ExhibitDescriptor descriptor() {
    return new ExhibitDescriptor(attributes.descriptor(),
            Maps.transformValues(frames, new Function<Frame, ObsDescriptor>() {
                @Override//from  w  w w .  j  ava2  s.  c  o  m
                public ObsDescriptor apply(Frame frame) {
                    return frame.descriptor();
                }
            }));
}

From source file:org.jboss.seam.social.URLUtils.java

private static String doFormUrlEncode(Map<String, String> map) {
    Map<String, String> urlEncodedMap = Maps.transformValues(map, new Function<String, String>() {

        @Override//from w  ww. j  a  v  a 2 s. c o  m
        public String apply(String input) {
            // TODO Auto-generated method stub
            return formURLEncode(input);
        }

    });

    return queryMapJoiner.join(urlEncodedMap);
}

From source file:com.facebook.buck.distributed.DistributedBuildCellIndexer.java

private static BuildJobStateBuckConfig dumpConfig(BuckConfig buckConfig) {
    BuildJobStateBuckConfig jobState = new BuildJobStateBuckConfig();

    jobState.setUserEnvironment(buckConfig.getEnvironment());
    Map<String, List<OrderedStringMapEntry>> rawConfig = Maps.transformValues(
            buckConfig.getRawConfigForDistBuild(),
            new Function<ImmutableMap<String, String>, List<OrderedStringMapEntry>>() {
                @Override//from  w ww  .java  2s.  c o m
                public List<OrderedStringMapEntry> apply(ImmutableMap<String, String> input) {
                    List<OrderedStringMapEntry> result = new ArrayList<>();
                    for (Map.Entry<String, String> entry : input.entrySet()) {
                        result.add(new OrderedStringMapEntry(entry.getKey(), entry.getValue()));
                    }
                    return result;
                }
            });
    jobState.setRawBuckConfig(rawConfig);
    jobState.setArchitecture(buckConfig.getArchitecture().name());
    jobState.setPlatform(buckConfig.getPlatform().name());

    return jobState;
}

From source file:io.crate.analyze.relations.RelationNormalizer.java

private static Map<QualifiedName, AnalyzedRelation> mapSourceRelations(MultiSourceSelect multiSourceSelect) {
    return Maps.transformValues(multiSourceSelect.sources(),
            new com.google.common.base.Function<RelationSource, AnalyzedRelation>() {
                @Override/*from   w w w  .j  ava  2s.  c om*/
                public AnalyzedRelation apply(RelationSource input) {
                    return input.relation();
                }
            });
}

From source file:com.google.api.client.discovery.RestResource.java

/**
 * Returns a map of the methods on this resource.
 *//*from   ww  w . ja  v a  2s  .  c o m*/
public Map<String, RestMethod> getMethods() {
    if (resource.getMethods() == null) {
        return Collections.emptyMap();
    }

    return Maps.transformValues(resource.getMethods(), new Function<Restmethod, RestMethod>() {
        public RestMethod apply(Restmethod input) {
            return new RestMethod(topLevelSchemas, input);
        }
    });
}