List of usage examples for com.google.common.collect Multimap put
boolean put(@Nullable K key, @Nullable V value);
From source file:org.obm.sync.client.login.LoginClient.java
@Override public AccessToken login(String loginAtDomain, String password) throws AuthFault { Multimap<String, String> params = ArrayListMultimap.create(); params.put("login", loginAtDomain); params.put("password", password); params.put("origin", origin); AccessToken token = newAccessToken(loginAtDomain, origin); Document doc = execute(token, "/login/doLogin", params); exceptionFactory.checkLoginExpection(doc); return fillToken(token, doc); }
From source file:com.b2international.snowowl.snomed.exporter.server.rf2.SnomedLanguageRefSetExporter.java
@Override protected Hits<SnomedRefSetMemberIndexEntry> filter(Hits<SnomedRefSetMemberIndexEntry> allResults) throws IOException { Multimap<String, SnomedRefSetMemberIndexEntry> referencedComponentToMemberMap = ArrayListMultimap.create(); allResults.getHits().forEach(m -> referencedComponentToMemberMap.put(m.getReferencedComponentId(), m)); Query<String> query = Query.select(String.class).from(SnomedDescriptionIndexEntry.class) .fields(SnomedDescriptionIndexEntry.Fields.ID) .where(Expressions.builder() .filter(SnomedDescriptionIndexEntry.Expressions .ids(referencedComponentToMemberMap.keySet())) .filter(SnomedDescriptionIndexEntry.Expressions.languageCode(languageCode)).build()) .limit(referencedComponentToMemberMap.keySet().size()).build(); List<String> descriptionIdsWithLanguageCode = getSearcher().search(query).getHits(); List<SnomedRefSetMemberIndexEntry> filteredMembers = descriptionIdsWithLanguageCode.stream() .flatMap(id -> referencedComponentToMemberMap.get(id).stream()).collect(toList()); return new Hits<SnomedRefSetMemberIndexEntry>(filteredMembers, null, null, allResults.getLimit(), allResults.getTotal());//ww w . jav a 2s. c om }
From source file:dynamicswordskills.api.ItemSkillProvider.java
@Override public Multimap getAttributeModifiers(ItemStack stack) { Multimap multimap = super.getAttributeModifiers(stack); multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Weapon modifier", weaponDamage, 0)); return multimap; }
From source file:com.eucalyptus.cloudwatch.workflow.alarms.AlarmStateEvaluationDispatcher.java
private List<List<AlarmEntity>> makeResultsList(List<AlarmEntity> results) { Multimap<Class, AlarmEntity> classMultiMap = LinkedListMultimap.create(); for (AlarmEntity alarmEntity : results) { classMultiMap.put(MetricEntityFactory.getClassForEntitiesGet(alarmEntity.getMetricType(), MetricManager.hash(alarmEntity.getDimensionMap())), alarmEntity); }//from w ww . j a va 2s . co m List<Iterator<List<AlarmEntity>>> iterators = Lists.newArrayList(); for (Class clazz : classMultiMap.keySet()) { iterators.add(Iterables.partition(classMultiMap.get(clazz), 100).iterator()); } List<List<AlarmEntity>> retVal = Lists.newArrayList(); boolean atLeastOneMightHaveMore = true; while (atLeastOneMightHaveMore) { atLeastOneMightHaveMore = false; for (Iterator<List<AlarmEntity>> iterator : iterators) { if (iterator.hasNext()) { atLeastOneMightHaveMore = true; retVal.add(iterator.next()); } } } return retVal; }
From source file:de.minigames.mclib.nms.v185.items.CustomSword.java
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override//from www .j a va2 s. co m public Multimap i() { Multimap localMultimap = super.i(); if (this.attackModifiersUsed) { localMultimap.put(GenericAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(f, "Weapon modifier", this.attackDmg, 0)); //$NON-NLS-1$ } return localMultimap; }
From source file:de.minigames.mclib.nms.v183.items.CustomSword.java
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override//from w w w . j av a 2 s . c o m public Multimap i() { Multimap localMultimap = super.i(); if (this.attackModifiersUsed) { localMultimap.put(GenericAttributes.e.getName(), new AttributeModifier(f, "Weapon modifier", this.attackDmg, 0)); //$NON-NLS-1$ } return localMultimap; }
From source file:org.ldp4j.http.ImmutableNegotiationResult.java
private <T extends Negotiable> void addVariantHeaders(final Multimap<String, String> headers, final Set<T> headerCandidates, final String headerName) { if (!headerCandidates.isEmpty()) { headers.put(ContentNegotiation.VARY, headerName); for (Negotiable candidate : headerCandidates) { headers.put(headerName, candidate.toHeader()); }/*from w w w . j av a 2 s. co m*/ } }
From source file:org.activityinfo.legacy.shared.model.LockedPeriodSet.java
private void addEnabled(Multimap<Integer, LockedPeriodDTO> map, int key, Iterable<LockedPeriodDTO> periods) { for (LockedPeriodDTO lock : periods) { if (lock.isEnabled()) { map.put(key, lock); }/*from w ww . j a va 2 s .com*/ } }
From source file:org.caltoopia.frontend.ui.launch.FindTopNetworks.java
public List<String> find(List<String> paths) { ResourceSet resourceSet = new ResourceSetImpl(); // Scan the paths for actors & networks. List<String> files = new ArrayList<String>(); for (String path : paths) { getActors(files, new File(path)); }// w w w.ja v a 2 s . c o m Multimap<String, URI> uris = HashMultimap.create(); for (int i = 0; i < files.size(); i++) { uris.put(files.get(i), URI.createFileURI(files.get(i))); } ContainersStateFactory containersStateFactory = new ContainersStateFactory(); IAllContainersState containersState = containersStateFactory.getContainersState(files, uris); resourceSet.eAdapters().add(new DelegatingIAllContainerAdapter(containersState)); Collection<URI> values = Sets.newHashSet(uris.values()); for (URI uri : values) { resourceSet.createResource(uri); } List<Resource> resources = Lists.newArrayList(resourceSet.getResources()); for (Resource res : resources) { try { res.load(null); doSwitch(res.getContents().get(0)); } catch (Exception x) { System.err.println("[FindTopNetworks] error: " + x.getMessage()); } } return topNetworks; }