Example usage for java.util Map values

List of usage examples for java.util Map values

Introduction

In this page you can find the example usage for java.util Map values.

Prototype

Collection<V> values();

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:com.yahoo.sql4d.sql4ddriver.Util.java

public static void printTable(List<String> baseFieldNames, Map<Object, List<Object>> baseAllRows) {
    for (String header : baseFieldNames) {
        printf("%-10s  |", header);
    }/*w  w  w  .  ja va 2  s  .c o  m*/
    newLine();
    for (List<Object> row : baseAllRows.values()) {
        for (Object rowColValue : row) {
            printf("%-10s  |", rowColValue);
        }
        newLine();
    }
}

From source file:com.ericsson.eiffel.remrem.generate.cli.CLIOptions.java

/**
 * Lists the versions of generate and all loaded protocols  
 *//*w  w w. j a  v  a  2s . c o m*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void printVersions() {
    Map versions = new VersionService().getMessagingVersions();
    Map<String, String> endpointVersions = (Map<String, String>) versions.get("endpointVersions");
    Map<String, String> serviceVersion = (Map<String, String>) versions.get("serviceVersion");

    if (serviceVersion != null) {
        System.out.print("REMREM Generate version ");
        for (String version : serviceVersion.values()) {
            System.out.println(version);
        }
    }
    if (endpointVersions != null) {
        System.out.println("Available endpoints");
        for (Map.Entry<String, String> entry : endpointVersions.entrySet()) {
            System.out.println(entry);
        }
    }
    exit(0);
}

From source file:com.wrmsr.wava.TestWhatever.java

public static Node cfgStackify(Map<Name, Basic> basics) {
    checkState(basics.values().stream().allMatch(basic -> basic.getIndex().isPresent()));
    checkState(basics.values().stream().flatMap(basic -> optionalToStream(basic.getIndex()).boxed())
            .collect(toImmutableSet()).size() == basics.size());

    throw new IllegalStateException();
}

From source file:org.activiti.spring.SpringConfigurationHelper.java

public static ProcessEngine buildProcessEngine(URL resource) {
    log.debug(//from   w  ww . j  av a 2  s .c  o m
            "==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE =========================================");

    ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource));
    Map<String, ProcessEngine> beansOfType = applicationContext.getBeansOfType(ProcessEngine.class);
    if ((beansOfType == null) || (beansOfType.isEmpty())) {
        throw new ActivitiException("no " + ProcessEngine.class.getName()
                + " defined in the application context " + resource.toString());
    }

    ProcessEngine processEngine = beansOfType.values().iterator().next();

    log.debug(
            "==== SPRING PROCESS ENGINE CREATED ==================================================================");
    return processEngine;
}

From source file:com.liveramp.cascading_ext.counters.Counters.java

private static String prettyTaps(Map<String, Tap> taps) {
    if (taps.keySet().isEmpty()) {
        return "[]";
    }/*from w w w.j a  va2 s .  c  om*/

    Collection<Tap> values = taps.values();
    Tap first = values.toArray(new Tap[values.size()])[0];
    if (first == null) {
        return "[null tap]";
    }

    if (taps.keySet().size() == 1) {
        return "[\"" + first.getIdentifier() + "\"]";
    } else {
        return "[\"" + first.getIdentifier() + "\",...]";
    }
}

From source file:edu.utexas.cs.tactex.utils.BrokerUtils.java

/**
 * /*from   w w  w . j  a  va 2  s . c  o  m*/
 * @param subscriptions
 * @return
 */
public static <K> Integer sumMapValues(Map<K, Integer> map) {
    Integer totalSubs = 0;
    for (Integer subs : map.values()) {
        totalSubs += subs;
    }
    return totalSubs;
}

From source file:net.recommenders.rival.evaluation.statistics.EffectSize.java

/**
 * Computes Cohen's d, either the classical formulation (dividing the pooled
 * standard deviation by the sum of the number of samples) or using the
 * least squares estimation (substracting 2 to the sum of the number of
 * samples when normalizing the pooled standard deviation).
 *
 * @param <V> type of the keys of each map.
 * @param baselineMetricPerDimension map for the baseline method, one value
 * for each user (dimension)//w w  w .j  a v  a 2s  . c  o m
 * @param testMetricPerDimension map for the test method, one value for each
 * user (dimension)
 * @param doLeastSquares flag to use one formulation or the other (see
 * description above)
 * @return the computed Cohen's d as estimation of the effect size..
 */
public static <V> double getCohenD(final Map<V, Double> baselineMetricPerDimension,
        final Map<V, Double> testMetricPerDimension, final boolean doLeastSquares) {
    SummaryStatistics statsBaseline = new SummaryStatistics();
    for (double d : baselineMetricPerDimension.values()) {
        statsBaseline.addValue(d);
    }
    SummaryStatistics statsTest = new SummaryStatistics();
    for (double d : testMetricPerDimension.values()) {
        statsTest.addValue(d);
    }
    if (doLeastSquares) {
        return getCohenDLeastSquares((int) statsBaseline.getN(), statsBaseline.getMean(),
                statsBaseline.getStandardDeviation(), (int) statsTest.getN(), statsTest.getMean(),
                statsTest.getStandardDeviation());
    }
    return getCohenD((int) statsBaseline.getN(), statsBaseline.getMean(), statsBaseline.getStandardDeviation(),
            (int) statsTest.getN(), statsTest.getMean(), statsTest.getStandardDeviation());
}

From source file:org.openmrs.module.pagecheck.Pages.java

/**
 * Gets all URLs which have been mapped to controllers in Spring
 * @return the URLs/*from w  w  w.  j  a  v  a 2 s. c  om*/
 */
@SuppressWarnings("unchecked")
public static Set<String> getMappedURLs() {
    Set<String> urls = new TreeSet<String>();

    Map<String, SimpleUrlHandlerMapping> simpleHandlers = ContextProvider.getApplicationContext()
            .getBeansOfType(SimpleUrlHandlerMapping.class);
    Map<String, DefaultAnnotationHandlerMapping> annotationBeans = ContextProvider.getApplicationContext()
            .getBeansOfType(DefaultAnnotationHandlerMapping.class);

    for (SimpleUrlHandlerMapping handler : simpleHandlers.values())
        urls.addAll(handler.getHandlerMap().keySet());

    for (DefaultAnnotationHandlerMapping handler : annotationBeans.values())
        urls.addAll(handler.getHandlerMap().keySet());

    return urls;
}

From source file:cpcc.commons.pages.ros.RosDeviceDetail.java

/**
 * @param state the state map.//from   w w w. jav  a 2  s  .c  o  m
 * @return the parameter list.
 */
private static Collection<String> renderParameterList(Map<String, List<String>> state) {
    if (state == null) {
        return Collections.emptySet();
    }

    Map<String, String> parameterMap = new TreeMap<String, String>();
    for (Entry<String, List<String>> entry : state.entrySet()) {
        parameterMap.put(entry.getKey(), getEntryString(entry.getKey(), entry.getValue()));
    }

    return parameterMap.values();
}

From source file:org.shareok.data.webserv.WebUtil.java

public static ModelAndView getServerList(ModelAndView model, RepoServerService serverService)
        throws JsonProcessingException {

    Map<String, String> serverList = serverService.getServerNameIdList();

    if (null != serverList && serverList.size() > 0) {

        ObjectMapper mapper = new ObjectMapper();

        Collection<String> ids = serverList.values();
        List<RepoServer> serverObjList = serverService.getServerObjList(ids);

        String serverListJson = mapper.writeValueAsString(serverList);
        model.addObject("serverList", serverListJson);
        model.addObject("serverObjList", mapper.writeValueAsString(serverObjList));
    } else {/*  w  ww .j a va 2  s  .  c o m*/
        //            model.addObject("emptyServerList", "There are NO servers set up.");
    }

    return model;
}