本文整理匯總了Java中com.google.common.collect.ListMultimap.put方法的典型用法代碼示例。如果您正苦於以下問題:Java ListMultimap.put方法的具體用法?Java ListMultimap.put怎麽用?Java ListMultimap.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.ListMultimap
的用法示例。
在下文中一共展示了ListMultimap.put方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addDependencyForRelocation
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
public void addDependencyForRelocation(ModuleVersionSelector selector) {
// Some POMs depend on themselves through their parent POM, don't add this dependency
// since Ivy doesn't allow this!
// Example: http://repo2.maven.org/maven2/com/atomikos/atomikos-util/3.6.4/atomikos-util-3.6.4.pom
if (selector.getGroup().equals(descriptor.getComponentIdentifier().getGroup())
&& selector.getName().equals(descriptor.getComponentIdentifier().getModule())) {
return;
}
// TODO - this is a constant
ListMultimap<String, String> confMappings = ArrayListMultimap.create();
// Map dependency on all public configurations
for (Configuration m2Conf : GradlePomModuleDescriptorBuilder.MAVEN2_CONFIGURATIONS.values()) {
if (m2Conf.isVisible()) {
confMappings.put(m2Conf.getName(), m2Conf.getName());
}
}
dependencies.add(new IvyDependencyMetadata(selector, confMappings));
}
示例2: getAttachmentsForItemIds
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, Attachment> getAttachmentsForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
"select a, i.id from Item i join i.attachments a where i.id in (:items) order by index(a) ASC", "items",
ids);
ListMultimap<Long, Attachment> multiMap = ArrayListMultimap.create();
for( Object[] attachmentRow : attachments )
{
multiMap.put((Long) attachmentRow[1], (Attachment) attachmentRow[0]);
}
return multiMap;
}
示例3: getHistoryForItemIds
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, HistoryEvent> getHistoryForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> history = getHibernateTemplate().findByNamedParam(
"select h, i.id from Item i join i.history h where i.id in (:items) order by index(h)", "items", ids);
ListMultimap<Long, HistoryEvent> multiMap = ArrayListMultimap.create();
for( Object[] historyRow : history )
{
multiMap.put((Long) historyRow[1], (HistoryEvent) historyRow[0]);
}
return multiMap;
}
示例4: getNavigationNodesForItemIds
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public ListMultimap<Long, ItemNavigationNode> getNavigationNodesForItemIds(Collection<Long> ids)
{
if( ids.isEmpty() )
{
return ImmutableListMultimap.of();
}
List<Object[]> node = getHibernateTemplate().findByNamedParam(
"select n, i.id from ItemNavigationNode n join n.item i where i.id in (:items) order by n.index ASC",
"items", ids);
ListMultimap<Long, ItemNavigationNode> multiMap = ArrayListMultimap.create();
for( Object[] nodeRow : node )
{
multiMap.put((Long) nodeRow[1], (ItemNavigationNode) nodeRow[0]);
}
return multiMap;
}
示例5: getCollaboratorsForItemIds
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Override
@Transactional(propagation = Propagation.MANDATORY)
public Multimap<Long, String> getCollaboratorsForItemIds(Collection<Long> itemIds)
{
if( itemIds.isEmpty() )
{
return ImmutableMultimap.of();
}
List<Object[]> attachments = getHibernateTemplate().findByNamedParam(
"select c, i.id from Item i join i.collaborators c where i.id in (:items)", "items", itemIds);
ListMultimap<Long, String> multiMap = ArrayListMultimap.create();
for( Object[] attachmentRow : attachments )
{
multiMap.put((Long) attachmentRow[1], (String) attachmentRow[0]);
}
return multiMap;
}
示例6: maakLookupMap
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private ListMultimap<Integer, AttribuutElement> maakLookupMap() {
final Set<Integer> alleTeLeverenStamtabellen = new HashSet<>();
for (ObjectElement objectElement : ElementHelper.getObjecten()) {
if (StringUtils.isNotEmpty(objectElement.getSoortInhoud()) && !(SoortInhoud.D.getCode().equals(objectElement.getSoortInhoud()))) {
alleTeLeverenStamtabellen.add(objectElement.getId());
}
}
final ListMultimap<Integer, AttribuutElement> attribuutMultimap = ArrayListMultimap.create();
for (AttribuutElement attribuutElement : ElementHelper.getAttributen()) {
if (alleTeLeverenStamtabellen.contains(attribuutElement.getObjectType())) {
attribuutMultimap.put(attribuutElement.getObjectType(), attribuutElement);
}
}
return attribuutMultimap;
}
示例7: siFile
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private static ListMultimap<Long, SignPost> siFile(TomtomFolder folder) {
ListMultimap<Long, SignPost> signs = ArrayListMultimap.create();
File file = new File(folder.getFile("si.dbf"));
if (!file.exists()) {
return signs;
}
log.info("Reading SI {}", file);
try (DbfReader reader = new DbfReader(file)) {
DbfRow row;
while ((row = reader.nextRow()) != null) {
if (row.getInt("AMBIG") != 1) {
SignPost sign = SignPost.fromRow(row);
signs.put(sign.getId(), sign);
}
}
}
log.info("Loaded {} si", signs.size());
return signs;
}
示例8: assertErrorsOnLines
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
/**
* Asserts that the given diagnostics contain errors with a message containing "[CheckerName]"
* on the given lines of the given file. If there should be multiple errors on a line, the line
* number must appear multiple times. There may not be any errors in any other file.
*/
public void assertErrorsOnLines(String file,
List<Diagnostic<? extends JavaFileObject>> diagnostics, long... lines) {
ListMultimap<String, Long> actualErrors = ArrayListMultimap.create();
for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {
String message = diagnostic.getMessage(Locale.US);
// The source may be null, e.g. for diagnostics about command-line flags
assertNotNull(message, diagnostic.getSource());
String sourceName = diagnostic.getSource().getName();
assertEquals(
"unexpected error in source file " + sourceName + ": " + message,
file, sourceName);
actualErrors.put(diagnostic.getSource().getName(), diagnostic.getLineNumber());
// any errors from the compiler that are not related to this checker should fail
assertThat(message).contains("[" + checker.getAnnotation(BugPattern.class).name() + "]");
}
assertEquals(
ImmutableMultiset.copyOf(Longs.asList(lines)),
ImmutableMultiset.copyOf(actualErrors.get(file)));
}
示例9: createPermissions
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private ListMultimap<String,TablePermission> createPermissions() {
ListMultimap<String,TablePermission> permissions = ArrayListMultimap.create();
permissions.put("george", new TablePermission(TEST_TABLE, null,
TablePermission.Action.READ));
permissions.put("george", new TablePermission(TEST_TABLE, TEST_FAMILY,
TablePermission.Action.WRITE));
permissions.put("george", new TablePermission(TEST_TABLE2, null,
TablePermission.Action.READ));
permissions.put("hubert", new TablePermission(TEST_TABLE2, null,
TablePermission.Action.READ, TablePermission.Action.WRITE));
return permissions;
}
示例10: decomposeIdentifiers
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
static ListMultimap<SchemaPath, YangInstanceIdentifier> decomposeIdentifiers(final Set<DOMRpcIdentifier> rpcs) {
final ListMultimap<SchemaPath, YangInstanceIdentifier> ret = LinkedListMultimap.create();
for (DOMRpcIdentifier i : rpcs) {
ret.put(i.getType(), i.getContextReference());
}
return ret;
}
示例11: partitionToClasses
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private ListMultimap<String, T> partitionToClasses(List<T> instances) {
ListMultimap<String, T> map = ArrayListMultimap.create();
for (T instance : instances) {
map.put(labelFunction.apply(instance), instance);
}
return map;
}
示例12: getPropertiesMapFromElementPatterns
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private <T extends CypherElementPattern> ListMultimap<String, CypherAstBase> getPropertiesMapFromElementPatterns(
MemgraphCypherQueryContext ctx,
List<T> elementPatterns
) {
ListMultimap<String, CypherAstBase> results = ArrayListMultimap.create();
for (CypherElementPattern elementPattern : elementPatterns) {
for (Map.Entry<String, CypherAstBase> entry : elementPattern.getPropertiesMap().entrySet()) {
results.put(ctx.normalizePropertyName(entry.getKey()), entry.getValue());
}
}
return results;
}
示例13: profilesByLanguage
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private static ListMultimap<String, RulesProfile> profilesByLanguage(ProfileDefinition[] profileDefinitions) {
ListMultimap<String, RulesProfile> byLang = ArrayListMultimap.create();
for (ProfileDefinition definition : profileDefinitions) {
ValidationMessages validation = ValidationMessages.create();
RulesProfile profile = definition.createProfile(validation);
if (profile != null && !validation.hasErrors()) {
byLang.put(StringUtils.lowerCase(profile.getLanguage()), profile);
}
}
return byLang;
}
示例14: setACL
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
/**
* @param perms A map of permissions for a user or users
*/
public Query setACL(Map<String, Permission> perms) {
ListMultimap<String, Permission> permMap = ArrayListMultimap.create();
for (Map.Entry<String, Permission> entry : perms.entrySet()) {
permMap.put(entry.getKey(), entry.getValue());
}
setAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL,
ProtobufUtil.toUsersAndPermissions(permMap).toByteArray());
return this;
}
示例15: loadAll
import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
/**
* Loads all of the permission grants stored in a region of the {@code _acl_}
* table.
*
* @param aclRegion
* @return a map of the permissions for this table.
* @throws IOException
*/
static Map<byte[], ListMultimap<String,TablePermission>> loadAll(Region aclRegion)
throws IOException {
if (!isAclRegion(aclRegion)) {
throw new IOException("Can only load permissions from "+ACL_TABLE_NAME);
}
Map<byte[], ListMultimap<String, TablePermission>> allPerms =
new TreeMap<byte[], ListMultimap<String, TablePermission>>(Bytes.BYTES_RAWCOMPARATOR);
// do a full scan of _acl_ table
Scan scan = new Scan();
scan.addFamily(ACL_LIST_FAMILY);
InternalScanner iScanner = null;
try {
iScanner = aclRegion.getScanner(scan);
while (true) {
List<Cell> row = new ArrayList<Cell>();
boolean hasNext = iScanner.next(row);
ListMultimap<String,TablePermission> perms = ArrayListMultimap.create();
byte[] entry = null;
for (Cell kv : row) {
if (entry == null) {
entry = CellUtil.cloneRow(kv);
}
Pair<String,TablePermission> permissionsOfUserOnTable =
parsePermissionRecord(entry, kv);
if (permissionsOfUserOnTable != null) {
String username = permissionsOfUserOnTable.getFirst();
TablePermission permissions = permissionsOfUserOnTable.getSecond();
perms.put(username, permissions);
}
}
if (entry != null) {
allPerms.put(entry, perms);
}
if (!hasNext) {
break;
}
}
} finally {
if (iScanner != null) {
iScanner.close();
}
}
return allPerms;
}