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:edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult.BaseIndividualSearchResult.java

public Collection<String> getMostSpecificTypes() {
    ObjectPropertyStatementDao opsDao = vreq.getWebappDaoFactory().getObjectPropertyStatementDao();
    Map<String, String> types = opsDao.getMostSpecificTypesInClassgroupsForIndividual(individual.getURI());
    return types.values();
}

From source file:edu.umd.umiacs.clip.tools.scor.BM25Scorer.java

@Override
public float scoreProcessed(Object query, Object text) {
    Map<String, Integer> docTerms = (Map<String, Integer>) text;
    int length = docTerms.values().stream().mapToInt(f -> f).sum();
    return (float) ((Map<String, Pair<Integer, Float>>) query).entrySet().stream()
            .filter(entry -> docTerms.containsKey(entry.getKey())).mapToDouble(pair -> pair.getValue().getLeft()
                    * bm25(docTerms.get(pair.getKey()), pair.getValue().getRight(), length))
            .sum();/*w w  w  .  j a  v  a 2  s  . com*/
}

From source file:org.jasig.cas.util.AutowiringSchedulerFactoryBean.java

public void afterPropertiesSet() throws Exception {
    final Map<String, Trigger> triggers = this.applicationContext.getBeansOfType(Trigger.class);
    super.setTriggers(triggers.values().toArray(new Trigger[triggers.size()]));

    if (log.isDebugEnabled()) {
        log.debug("Autowired the following triggers defined in application context: "
                + triggers.keySet().toString());
    }/*w  w w.j a  va  2 s.c om*/

    super.afterPropertiesSet();
}

From source file:com.adobe.acs.commons.replication.impl.AgentHostsImpl.java

@Override
public final List<String> getHosts(final AgentFilter agentFilter) {
    final List<String> hosts = new ArrayList<String>();
    final Map<String, Agent> agents = agentManager.getAgents();

    for (final Agent agent : agents.values()) {
        if (!agentFilter.isIncluded(agent)) {
            continue;
        }/*w  w w  .  j a  v a 2  s  .  c  o  m*/

        try {
            final URI uri = new URI(agent.getConfiguration().getTransportURI());

            String tmp = StringUtils.defaultIfEmpty(uri.getScheme(), DEFAULT_SCHEME) + "://" + uri.getHost();
            if (uri.getPort() > 0) {
                tmp += ":" + uri.getPort();
            }

            hosts.add(tmp);
        } catch (URISyntaxException e) {
            log.error("Unable to extract a scheme/host/port from Agent transport URI [ {} ]",
                    agent.getConfiguration().getTransportURI());
        }
    }

    return hosts;
}

From source file:de.tudarmstadt.ukp.clarin.webanno.brat.curation.CasDiff2.java

/**
 * Calculate the differences between CASes.
 * /*from ww w . ja  va2s  .co  m*/
 * @param aEntryTypes
 *            the type for which differences are to be calculated.
 * @param aAdapters
 *            a set of diff adapters how the diff algorithm should handle different features
 * @param aCasMap
 *            a set of CASes, each associated with an ID
 * @return a diff result.
 */
public static DiffResult doDiff(List<String> aEntryTypes, Collection<? extends DiffAdapter> aAdapters,
        Map<String, List<JCas>> aCasMap) {
    if (aCasMap.isEmpty()) {
        return new DiffResult(new CasDiff2(0, 0, aAdapters));
    }

    List<JCas> casList = aCasMap.values().iterator().next();
    if (casList.isEmpty()) {
        return new DiffResult(new CasDiff2(0, 0, aAdapters));
    }

    return doDiff(aEntryTypes, aAdapters, aCasMap, -1, -1);
}

From source file:cc.kave.commons.pointsto.evaluation.UsagePruning.java

/**
 * @return The number of pruned usages//from  w w  w  .  ja v a 2s. c o m
 */
public int prune(final int maxUsages, Map<ProjectIdentifier, List<Usage>> usages) {
    final int initialNumUsages = usages.values().stream().mapToInt(Collection::size).sum();
    int numUsages = initialNumUsages;

    if (numUsages > maxUsages) {
        Random rnd = new Random(rndGenerator.nextLong());
        List<Pair<ProjectIdentifier, Double>> projectUsageCounts = new ArrayList<>(usages.size());
        for (Map.Entry<ProjectIdentifier, List<Usage>> entry : usages.entrySet()) {
            projectUsageCounts.add(Pair.create(entry.getKey(), (double) entry.getValue().size()));
            Collections.shuffle(entry.getValue(), rnd);
        }
        EnumeratedDistribution<ProjectIdentifier> distribution = new EnumeratedDistribution<>(rndGenerator,
                projectUsageCounts);

        while (numUsages > maxUsages) {
            ProjectIdentifier project = distribution.sample();
            List<Usage> projectUsages = usages.get(project);
            if (!projectUsages.isEmpty()) {
                projectUsages.remove(projectUsages.size() - 1);
                --numUsages;
            }
        }
    }

    return initialNumUsages - numUsages;
}

From source file:eu.europa.ejusticeportal.dss.model.SigningMethodsHomeTest.java

private int getMethodsCount(Map<String, List<SigningMethod>> methods) {
    int count = 0;
    for (List<SigningMethod> ms : methods.values()) {
        count += ms.size();/*w w  w .  jav  a 2s  .  c o  m*/
    }
    return count;
}

From source file:net.firejack.platform.core.validation.constraint.RuleMapper.java

protected void onContextRefreshed(ContextRefreshedEvent event) {
    ApplicationContext context = event.getApplicationContext();
    Map<String, Object> beans = context.getBeansWithAnnotation(RuleSource.class);

    for (Object bean : beans.values()) {
        Class<?> clazz = bean.getClass();
        RuleSource ruleSource = clazz.getAnnotation(RuleSource.class);
        if (ruleSource != null) {
            if (StringUtils.isNotBlank(ruleSource.value())) {
                CONSTRAINT_LOCATIONS.put(ruleSource.value(), clazz);
            }//from  w  w  w  . jav a2  s . co  m
        }
    }
}

From source file:uk.co.bssd.monitoring.spring.SpringMonitorsLoader.java

@Override
public void load(Monitors monitors) {
    Map<String, MonitorDefinition> monitorDefinitions = this.context.getBeansOfType(MonitorDefinition.class);

    for (MonitorDefinition definition : monitorDefinitions.values()) {
        monitors.register(definition.monitor(), definition.monitorPeriodMs());
    }/* www  .j a  va  2 s. c om*/
}

From source file:uk.gov.hscic.common.repo.AbstractRepositoryFactory.java

@PostConstruct
public void postConstruct() {
    final Map<String, R> beans = applicationContext.getBeansOfType(repositoryClass());

    for (R repository : beans.values()) {
        repositories.put(repository.getSource(), repository);
    }//from  w  ww  . ja  v  a2  s.c o m
}