List of usage examples for java.util Map values
Collection<V> values();
From source file:com.acc.fulfilmentprocess.test.FraudCheckIntegrationTest.java
/** * revert changes made {@link #beforeClass()} *///from w w w.j a v a 2s. c om @AfterClass public static void afterClass() { LOG.debug("cleanup..."); final ApplicationContext appCtx = Registry.getApplicationContext(); assertTrue("Application context of type " + appCtx.getClass() + " is not a subclass of " + ConfigurableApplicationContext.class, appCtx instanceof ConfigurableApplicationContext); final ConfigurableApplicationContext applicationContext = (ConfigurableApplicationContext) appCtx; final ConfigurableListableBeanFactory beanFactory = applicationContext.getBeanFactory(); assertTrue("Bean Factory of type " + beanFactory.getClass() + " is not of type " + BeanDefinitionRegistry.class, beanFactory instanceof BeanDefinitionRegistry); //cleanup command factory final Map<String, CommandFactory> commandFactoryList = applicationContext .getBeansOfType(CommandFactory.class); commandFactoryList.remove("mockupCommandFactory"); final DefaultCommandFactoryRegistryImpl commandFactoryReg = appCtx .getBean(DefaultCommandFactoryRegistryImpl.class); commandFactoryReg.setCommandFactoryList(commandFactoryList.values()); }
From source file:com.ponysdk.jasper.export.DynamicExportDataSource.java
public DynamicExportDataSource(final Map<?, ?> map) { super();//from w w w . j ava 2 s.c o m this.list = map.values(); this.iterator = this.list.iterator(); }
From source file:org.openmrs.contrib.metadatarepository.dao.hibernate.HibernateConfigurationTest.java
@Test public void testColumnMapping() throws Exception { Session session = sessionFactory.openSession(); try {//from w ww . ja v a 2 s . com Map metadata = sessionFactory.getAllClassMetadata(); for (Object o : metadata.values()) { EntityPersister persister = (EntityPersister) o; String className = persister.getEntityName(); log.debug("Trying select * from: " + className); Query q = session.createQuery("from " + className + " c"); q.iterate(); log.debug("ok: " + className); } } finally { session.close(); } }
From source file:org.kani.spring.ViewFactory.java
@Override public Collection<Object> createAll(String applicationId) { Map<String, Object> viewBeans = applicationContext.getBeansWithAnnotation(View.class); return viewBeans.values(); }
From source file:com.netflix.lipstick.Main.java
private static int runEmbeddedScript(PigContext pigContext, String file, String engine) throws IOException { log.info("Run embedded script: " + engine); pigContext.connect();//ww w. ja va 2 s . c o m ScriptEngine scriptEngine = ScriptEngine.getInstance(engine); Map<String, List<PigStats>> statsMap = scriptEngine.run(pigContext, file); PigStatsUtil.setStatsMap(statsMap); int failCount = 0; int totalCount = 0; for (List<PigStats> lst : statsMap.values()) { if (lst != null && !lst.isEmpty()) { for (PigStats stats : lst) { if (!stats.isSuccessful()) failCount++; totalCount++; } } } return (totalCount > 0 && failCount == totalCount) ? ReturnCode.FAILURE : (failCount > 0) ? ReturnCode.PARTIAL_FAILURE : ReturnCode.SUCCESS; }
From source file:com.act.lcms.db.analysis.PathwayProductAnalysis.java
private static Map<Integer, String> extractPathwayStepIonsFromStandardIonAnalysis( List<ChemicalAssociatedWithPathway> pathwayChems, File lcmsDir, DB db, List<StandardWell> standardWells, String plottingDir, Map<Integer, Pair<Boolean, Boolean>> ionModesAvailable) throws Exception { Map<Integer, String> result = new HashMap<>(); for (ChemicalAssociatedWithPathway pathwayChem : pathwayChems) { Map<StandardWell, StandardIonResult> wellToIonRanking = StandardIonAnalysis .getBestMetlinIonsForChemical(pathwayChem.getChemical(), lcmsDir, db, standardWells, plottingDir);/*from ww w . j ava 2 s.c o m*/ Pair<Boolean, Boolean> modes = ionModesAvailable.get(pathwayChem.getId()); Map<StandardIonResult, String> chemicalToCuratedMetlinIon = new HashMap<>(); List<StandardIonResult> standardIonResults = new ArrayList<>(wellToIonRanking.values()); for (StandardIonResult standardIonResult : standardIonResults) { Integer manualOverrideId = standardIonResult.getManualOverrideId(); if (manualOverrideId != null) { chemicalToCuratedMetlinIon.put(standardIonResult, CuratedStandardMetlinIon.getBestMetlinIon(db, manualOverrideId).getBestMetlinIon()); } } String bestMetlinIon = AnalysisHelper.scoreAndReturnBestMetlinIonFromStandardIonResults( standardIonResults, chemicalToCuratedMetlinIon, modes.getLeft(), modes.getRight()); if (bestMetlinIon != null) { result.put(pathwayChem.getId(), bestMetlinIon); } else { result.put(pathwayChem.getId(), DEFAULT_SEARCH_ION); } } return result; }
From source file:org.sonews.daemon.CommandSelector.java
@PostConstruct protected void init() { Map<String, Command> commands = context.getBeansOfType(Command.class); commands.values().stream().forEach(this::mapCommandStringsToInstance); }
From source file:edu.umd.umiacs.clip.tools.scor.PSQW2VBM25Scorer.java
private float scoreWeighted(List<Map<String, Float>> wightedQuery, Map<String, Integer> docTerms) { int length = docTerms.values().parallelStream().mapToInt(f -> f).sum(); return (float) wightedQuery.parallelStream().mapToDouble(weightedTerm -> { List<Triple<Float, Float, Float>> list = weightedTerm.entrySet().stream() .filter(entry -> docTerms.containsKey(entry.getKey())) .map(entry -> ImmutableTriple.of(docTerms.get(entry.getKey()).floatValue(), (float) df(entry.getKey()), entry.getValue())) .collect(toList());/*from www . j av a2s . c o m*/ float averageTF = (float) list.parallelStream() .mapToDouble(triple -> triple.getLeft() * triple.getRight()).sum(); float averageDF = (float) list.parallelStream() .mapToDouble(triple -> triple.getMiddle() * triple.getRight()).sum(); return bm25(averageTF, averageDF, length); }).sum(); }
From source file:samples.SimpleSentimentAnalyzer.java
private int sumMapValues(Map<String, Integer> words) { int result = 0; for (Integer count : words.values()) { result += count;/* w w w .ja v a 2s. c om*/ } return result; }
From source file:gemlite.core.internal.index.compare.ComparatorImpl.java
private int compareBigMap(Map<?, ?> o1, Map<?, ?> o2) { if (o1 == null || o1.values() == null) return -1; if (o2 == null || o2.values() == null) return 1; CompareToBuilder cb = new CompareToBuilder(); cb.append(o1.toString(), o2.toString()); return cb.toComparison(); }