List of usage examples for com.google.common.collect ArrayListMultimap create
public static <K, V> ArrayListMultimap<K, V> create()
From source file:org.apache.cassandra.hadoop2.RingCache.java
public void refreshEndpointMap() { try {//from w ww .ja v a 2 s. c o m Cassandra.Client client = ConfigHelper.getClientFromOutputAddressList(conf); List<TokenRange> ring = client.describe_ring(ConfigHelper.getOutputKeyspace(conf)); rangeMap = ArrayListMultimap.create(); for (TokenRange range : ring) { Token<?> left = partitioner.getTokenFactory().fromString(range.start_token); Token<?> right = partitioner.getTokenFactory().fromString(range.end_token); Range<Token> r = new Range<Token>(left, right, partitioner); for (String host : range.endpoints) { try { rangeMap.put(r, InetAddress.getByName(host)); } catch (UnknownHostException e) { throw new AssertionError(e); // host strings are IPs } } } } catch (InvalidRequestException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } catch (TException e) { logger.debug("Error contacting seed list" + ConfigHelper.getOutputInitialAddress(conf) + " " + e.getMessage()); } }
From source file:com.github.nmorel.gwtjackson.guava.client.deser.ArrayListMultimapJsonDeserializer.java
@Override protected ArrayListMultimap<K, V> newMultimap() { return ArrayListMultimap.create(); }
From source file:org.sonar.core.workflow.WorkflowEngine.java
/** * @return non-null list of screens per review#violationId *///from www . ja v a 2 s . c o m public ListMultimap<Long, Screen> listAvailableScreens(DefaultReview[] reviews, DefaultWorkflowContext context, boolean verifyConditions) { ListMultimap<Long, Screen> result = ArrayListMultimap.create(); completeProjectSettings(context); for (Map.Entry<String, Screen> entry : workflow.getScreensByCommand().entrySet()) { String commandKey = entry.getKey(); if (!verifyConditions || verifyConditionsQuietly(null, context, workflow.getContextConditions(commandKey))) { for (DefaultReview review : reviews) { if (!verifyConditions || verifyConditionsQuietly(review, context, workflow.getReviewConditions(commandKey))) { result.put(review.getViolationId(), entry.getValue()); } } } } return result; }
From source file:eu.esdihumboldt.hale.ui.service.schema.util.NSTypeTreeContentProvider.java
/** * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object) *//*w w w . ja va 2 s . co m*/ @Override public Object[] getElements(Object inputElement) { if (inputElement == null) { nameSpaces = null; return new Object[0]; } @SuppressWarnings("unchecked") Collection<? extends TypeDefinition> types = (Collection<? extends TypeDefinition>) inputElement; nameSpaces = ArrayListMultimap.create(); for (TypeDefinition type : types) { // only show types with mappable flag if (!type.getConstraint(MappableFlag.class).isEnabled()) continue; String ns = type.getName().getNamespaceURI(); if (XMLConstants.NULL_NS_URI.equals(ns)) ns = "(no namespace)"; nameSpaces.put(ns, type); } return nameSpaces.keySet().toArray(); }
From source file:org.sonar.server.es.SearchQuery.java
private SearchQuery() { scrollSize = 10; indices = Lists.newArrayList(); types = Lists.newArrayList(); fieldCriteria = ArrayListMultimap.create(); notFieldCriteria = ArrayListMultimap.create(); }
From source file:com.haulmont.timesheets.global.WeeklyReportConverter.java
public List<WeeklyReportEntry> convertFromTimeEntries(List<TimeEntry> timeEntries) { if (timeEntries.isEmpty()) { return Collections.emptyList(); }/* w w w . j a va2s.c o m*/ final Multimap<TimeEntryGroupKey, TimeEntry> groupedTimeEntries = ArrayListMultimap.create(); for (TimeEntry timeEntry : timeEntries) { groupedTimeEntries.put(new TimeEntryGroupKey(timeEntry), timeEntry); } if (groupedTimeEntries.isEmpty()) { return Collections.emptyList(); } List<WeeklyReportEntry> reportEntries = new ArrayList<>(); for (Map.Entry<TimeEntryGroupKey, Collection<TimeEntry>> entry : groupedTimeEntries.asMap().entrySet()) { WeeklyReportEntry reportEntry = new WeeklyReportEntry(); TimeEntryGroupKey entryKey = entry.getKey(); reportEntry.setProject(entryKey.project); reportEntry.setTask(entryKey.task); reportEntry.setActivityType(entryKey.activityType); for (TimeEntry timeEntry : entry.getValue()) { reportEntry.addTimeEntry(timeEntry); } reportEntries.add(reportEntry); } return reportEntries; }
From source file:org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph.java
/** * Constructor */ public TmfGraph() { fNodeMap = NonNullUtils.checkNotNull(ArrayListMultimap.create()); fReverse = new HashMap<>(); }
From source file:com.isotrol.impe3.web20.client.content.counter.ContentCounterComponent.java
/** * Generates and IMG URI for the action. * @param context Render context./*ww w . j a v a 2 s. c o m*/ * @return URI to use. */ String getURI(final RenderContext context) { if (contentKey == null) { return null; } final String idr = contentKey.getContentType().getStringId() + ':' + contentKey.getContentId(); final String ct = config.counterType(); Multimap<String, Object> parameters = ArrayListMultimap.create(); parameters.put("idr", idr); parameters.put("ct", ct); return context.getAbsoluteActionURI("countAction", parameters).toASCIIString(); }
From source file:com.android.tools.idea.gradle.structure.daemon.analysis.PsAndroidModuleAnalyzer.java
@Override protected void doAnalyze(@NotNull PsAndroidModule module, @NotNull PsIssueCollection issueCollection) { Multimap<String, SyncIssue> issuesByData = ArrayListMultimap.create(); AndroidModuleModel gradleModel = module.getGradleModel(); Collection<SyncIssue> syncIssues = gradleModel.getAndroidProject().getSyncIssues(); for (SyncIssue syncIssue : syncIssues) { String data = nullToEmpty(syncIssue.getData()); issuesByData.put(data, syncIssue); }// ww w. j av a2 s . c o m PsModulePath modulePath = new PsModulePath(module); module.forEachDependency(dependency -> { if (dependency instanceof PsLibraryDependency && dependency.isDeclared()) { PsLibraryDependency libraryDependency = (PsLibraryDependency) dependency; PsPath path = new PsLibraryDependencyNavigationPath(getContext(), libraryDependency); PsArtifactDependencySpec resolvedSpec = libraryDependency.getResolvedSpec(); String issueKey = resolvedSpec.group + GRADLE_PATH_SEPARATOR + resolvedSpec.name; Collection<SyncIssue> librarySyncIssues = issuesByData.get(issueKey); for (SyncIssue syncIssue : librarySyncIssues) { PsIssue issue = createIssueFrom(syncIssue, path, modulePath); issueCollection.add(issue); } analyzeDeclaredDependency(libraryDependency, modulePath, issueCollection); } }); }
From source file:org.sonar.server.search.SearchQuery.java
private SearchQuery() { scrollSize = 10;// www . j a v a 2 s.c o m indices = Lists.newArrayList(); types = Lists.newArrayList(); fieldCriteria = ArrayListMultimap.create(); notFieldCriteria = ArrayListMultimap.create(); termFacets = Maps.newHashMap(); }