List of usage examples for com.google.common.collect ArrayListMultimap create
public static <K, V> ArrayListMultimap<K, V> create()
From source file:neon.editor.EventEditor.java
public void show() { model.clear();//from w w w . java 2s. com scripts = Editor.getStore().getScripts().keySet().toArray(new String[0]); events = ArrayListMultimap.create(); for (String event : Editor.getStore().getEvents().keySet()) { events.putAll(event, Editor.getStore().getEvents().get(event)); model.addElement(event); } frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); }
From source file:no.ssb.vtl.script.operations.FoldOperation.java
/** * Checks that none of the given columns have the identifier role. * * @throws IllegalArgumentException if one or more columns have the identifier role. *///from w ww . j a va 2s . c o m private static void checkNoIdentifiers(DataStructure structure, ImmutableSet<String> columns) { ListMultimap<Role, String> roles = ArrayListMultimap.create(); for (String elements : columns) { roles.put(structure.get(elements).getRole(), elements); } checkArgument(!roles.containsKey(Role.IDENTIFIER), "cannot fold identifier(s) [%s]", roles.get(Role.IDENTIFIER)); }
From source file:com.google.eclipse.mechanic.core.keybinding.KeyBindings.java
static Multimap<KbaChangeSetQualifier, Binding> buildQualifierToBindingMap(List<Binding> bindings) { Multimap<KbaChangeSetQualifier, Binding> result = ArrayListMultimap.create(); for (Binding binding : bindings) { result.put(qualifierForBinding(binding, Action.ADD), binding); }/*www . java 2 s . co m*/ return result; }
From source file:jip.plugin.PluginRegistryImpl.java
/** * Search for extension points and extensions and initialize the registry *//*from w w w .ja v a 2 s. c o m*/ public void initialize() { if (extensionPoints == null || extensions == null) { Reflections reflections = ReflectionUtils.get(); extensionPoints = reflections.getTypesAnnotatedWith(ExtensionPoint.class, true); log.debug("Plugin registry : found " + extensionPoints.size() + " extension points"); Set<Class<?>> extensions = reflections.getTypesAnnotatedWith(Extension.class, true); log.debug("Plugin registry : found " + extensions.size() + " extensions"); this.extensions = ArrayListMultimap.create(); // map extensions to extension points for (Class<?> extension : extensions) { boolean matched = false; for (Class<?> extensionPoint : extensionPoints) { if (extensionPoint.isAssignableFrom(extension)) { this.extensions.put(extensionPoint, extension); matched = true; } } if (!matched) { log.warn("No extension point found for " + extension.getName()); } } log.debug("Plugin registry : " + this.extensions.size() + " extensions registered"); } }
From source file:fi.vm.kapa.identification.pagetest.utils.LogoutPropagate.java
public Multimap<String, SPSession> getSessionMap() { Multimap<String, SPSession> sessionMap = ArrayListMultimap.create(); sessionMap.put("key", new SAML2SPSession("123", 10L, 10000L, new NameIDBuilder().buildObject("uri", "localname", "ns-prefix"), "assertedIndex")); return sessionMap; }
From source file:org.sonar.ide.eclipse.internal.ui.jobs.RefreshAllViolationsJob.java
@Override public boolean visit(final IResource resource) throws CoreException { if (resource instanceof IProject) { IProject project = (IProject) resource; if (!SonarUiPlugin.hasSonarNature(project)) { return false; }//from w w w. j a va 2 s. c om ProjectProperties projectProperties = ProjectProperties.getInstance(project); if (projectProperties.isAnalysedLocally()) { return false; } cleanMarkers(project); EclipseSonar sonar = EclipseSonar.getInstance(project); SourceCode sourceCode = sonar.search(project); if (sourceCode != null) { List<Violation> violations = sourceCode.getViolations2(); // Split violations by resource ArrayListMultimap<String, Violation> mm = ArrayListMultimap.create(); for (Violation violation : violations) { if (violation.getLine() != null) { // TODO violation not associated with line mm.put(violation.getResourceKey(), violation); } } // Associate violations with resources for (String resourceKey : mm.keySet()) { Resource sonarResource = new Resource().setKey(resourceKey); // adapt org.sonar.wsclient.services.Resource to IFile IFile file = PlatformUtils.adapt(sonarResource, IFile.class); if (file != null) { for (Violation violation : mm.get(resourceKey)) { createMarker(file, violation); } } } } return false; // do not visit members of this resource } return true; }
From source file:com.haulmont.cuba.security.global.UserSession.java
/** * INTERNAL/*from w w w .j a v a2s.com*/ */ public UserSession(UUID id, User user, Collection<Role> roles, Locale locale, boolean system) { this.id = id; this.user = user; this.system = system; for (Role role : roles) { this.roles.add(role.getName()); if (role.getType() != null) roleTypes.add(role.getType()); } this.locale = locale; if (user.getTimeZone() != null) this.timeZone = TimeZone.getTimeZone(user.getTimeZone()); //noinspection unchecked permissions = new Map[PermissionType.values().length]; for (int i = 0; i < permissions.length; i++) { permissions[i] = new HashMap<>(); } constraints = ArrayListMultimap.create(); attributes = new ConcurrentHashMap<>(); }
From source file:com.github.cbismuth.fdupes.Launcher.java
public Path launch(final Collection<String> args) throws IOException { try {// w w w . j ava 2s . com final Set<PathElement> uniqueElements = newConcurrentHashSet(); final Multimap<PathElement, PathElement> duplicates = synchronizedListMultimap( ArrayListMultimap.create()); directoryWalker.extractDuplicates(args, uniqueElements, duplicates); if (systemPropertyGetter.doOrganize()) { pathOrganizer.organize(uniqueElements); } final Path csvReport = new DuplicatesCsvReporter().report(duplicates); LOGGER.info("CSV report created at [{}]", csvReport); final Path logReport = new DuplicatesLogReporter(pathEscapeFunction).report(duplicates); LOGGER.info("Log report created at [{}]", csvReport); return logReport; } catch (final OutOfMemoryError ignored) { LOGGER.error("Not enough memory, solutions are:"); LOGGER.error("\t- increase Java heap size (e.g. -Xmx512m),"); LOGGER.error("\t- decrease byte buffer size (e.g. -Dfdupes.buffer.size=8k - default is 64k),"); LOGGER.error("\t- reduce the level of parallelism (e.g. -Dfdupes.parallelism=1)."); return null; } }
From source file:com.gdn.x.ui.controller.Evaluation.ScoringWeightController.java
@RequestMapping(value = { "/run-all-evaluation" }, method = RequestMethod.GET) public ModelAndView runAllGoldenListEvaluation() { ModelAndView modelAndView = new ModelAndView(); List<List<String>> listActualId = new ArrayList<List<String>>(); List<List<String>> listExpectedId = new ArrayList<List<String>>(); List<String> RecallCoordinate = Arrays.asList("0.0", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"); Multimap<String, List<Double>> listQueryAndPrecision = ArrayListMultimap.create(); for (int i = 0; i < 20; i++) { String parameter = contentGoldenListService.listContentGoldenList().get(i).getQuery(); String timeStamp = contentGoldenListService.listContentGoldenList().get(i).getTimeStamp(); try {//from w w w.j av a 2 s.c o m listActualId.add(searchByQueryEvaluation(parameter)); } catch (MalformedURLException ex) { Logger.getLogger(CommonControllerEvaluation.class.getName()).log(Level.SEVERE, null, ex); } catch (SolrServerException ex) { Logger.getLogger(CommonControllerEvaluation.class.getName()).log(Level.SEVERE, null, ex); } listExpectedId.add(contentGoldenListService .findContentGoldenListByQueryAndTimeStamp(parameter, timeStamp).get(0).getExpectedResult()); listQueryAndPrecision.put(parameter, listInterpolatedPrecision(listExpectedId, listActualId).get(i)); } //Method to save parameterWeight To Mongo // SaveParameterWeightToMongo(listExpectedId, listActualId); modelAndView.addObject("listParameterWeight", parameterWeightService.findAll()); //weight Parameter modelAndView.addObject("MapList", getParameter()); // Average precision modelAndView.addObject("precisionCoordinate", interpolateAveragePrecision(listExpectedId, listActualId)); modelAndView.addObject("recallCoordinate", RecallCoordinate); // SaveCoordinateToMongo(interpolateAveragePrecision(listExpectedId, listActualId)); modelAndView.addObject("listQueryAndPrecision", listQueryAndPrecision.asMap()); modelAndView.addObject("finalAverage", finalScoreInterpolatedPrecision(listExpectedId, listActualId)); modelAndView.setViewName("evaluation/field-list"); return modelAndView; }
From source file:uk.ac.cam.cl.dtg.picky.client.binding.PlanBinding.java
@Override protected Plan doCompute() throws Exception { if (cache == null || Strings.isNullOrEmpty(target) || fileSelection == null) return null; File targetFile = new File(target); if (!targetFile.isDirectory()) return null; ListMultimap<String, String> entrySelectionMap = ArrayListMultimap.create(); entrySelection.stream().filter(i -> i.getParent() != null) .forEach(i -> entrySelectionMap.put(i.getParent().getValue(), i.getValue())); Planner planner = new Planner(fileSelection, entrySelectionMap, cache, targetFile); return planner.plan(); }