當前位置: 首頁>>代碼示例>>Java>>正文


Java ListMultimap.get方法代碼示例

本文整理匯總了Java中com.google.common.collect.ListMultimap.get方法的典型用法代碼示例。如果您正苦於以下問題:Java ListMultimap.get方法的具體用法?Java ListMultimap.get怎麽用?Java ListMultimap.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.ListMultimap的用法示例。


在下文中一共展示了ListMultimap.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: listPluginRequests

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
public List<PluginRequest> listPluginRequests() {
    List<PluginRequest> pluginRequests = collect(specs, new Transformer<PluginRequest, DependencySpecImpl>() {
        public PluginRequest transform(DependencySpecImpl original) {
            return new DefaultPluginRequest(original.id, original.version, original.apply, original.lineNumber, scriptSource);
        }
    });

    ListMultimap<PluginId, PluginRequest> groupedById = CollectionUtils.groupBy(pluginRequests, new Transformer<PluginId, PluginRequest>() {
        public PluginId transform(PluginRequest pluginRequest) {
            return pluginRequest.getId();
        }
    });

    // Check for duplicates
    for (PluginId key : groupedById.keySet()) {
        List<PluginRequest> pluginRequestsForId = groupedById.get(key);
        if (pluginRequestsForId.size() > 1) {
            PluginRequest first = pluginRequests.get(0);
            PluginRequest second = pluginRequests.get(1);

            InvalidPluginRequestException exception = new InvalidPluginRequestException(second, "Plugin with id '" + key + "' was already requested at line " + first.getLineNumber());
            throw new LocationAwareException(exception, second.getScriptDisplayName(), second.getLineNumber());
        }
    }
    return pluginRequests;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:27,代碼來源:PluginRequestCollector.java

示例2: playerTicketsLoaded

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Override
public ListMultimap<String, ForgeChunkManager.Ticket> playerTicketsLoaded(ListMultimap<String, ForgeChunkManager.Ticket> tickets, World world)
{
	// We don't care what order the tickets are in, but filter out the invalid ones
	ListMultimap<String, ForgeChunkManager.Ticket> validTickets = ArrayListMultimap.create();

	for (String playerName : tickets.keySet())
	{
		List<ForgeChunkManager.Ticket> playerTickets = new ArrayList<>();

		for (ForgeChunkManager.Ticket tkt : tickets.get(playerName))
		{
			BlockPos ticketPosition = NBTUtil.getPosFromTag(tkt.getModData().getCompoundTag("position"));
			TileEntity te = world.getTileEntity(ticketPosition);
			if (te instanceof TileEntityChunkLoader)
			{
				playerTickets.add(tkt);
			}
		}

		validTickets.putAll(playerName, playerTickets);
	}

	return validTickets;
}
 
開發者ID:DarkMorford,項目名稱:Simple-Chunks,代碼行數:26,代碼來源:ChunkLoadingHandler.java

示例3: setPostBlobLoadStateToWritten

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
/**
 * Sets the post blob load state to WRITTEN.
 *
 * After a load from the blob file, all items have their state set to nothing.
 * If the load mode is set to incrementalState then we want the items that are in the current
 * merge result to have their state be WRITTEN.
 *
 * This will allow further updates with {@link #mergeData(MergeConsumer, boolean)} to ignore the
 * state at load time and only apply the new changes.
 *
 * @see #loadFromBlob(File, boolean)
 * @see DataItem#isWritten()
 */
private void setPostBlobLoadStateToWritten() {
    ListMultimap<String, I> itemMap = ArrayListMultimap.create();

    // put all the sets into list per keys. The order is important as the lower sets are
    // overridden by the higher sets.
    for (S dataSet : mDataSets) {
        ListMultimap<String, I> map = dataSet.getDataMap();
        for (Map.Entry<String, Collection<I>> entry : map.asMap().entrySet()) {
            itemMap.putAll(entry.getKey(), entry.getValue());
        }
    }

    // the items that represent the current state is the last item in the list for each key.
    for (String key : itemMap.keySet()) {
        List<I> itemList = itemMap.get(key);
        itemList.get(itemList.size() - 1).resetStatusToWritten();
    }
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:32,代碼來源:DataMerger.java

示例4: setPostBlobLoadStateToTouched

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
/**
 * Sets the post blob load state to TOUCHED.
 *
 * After a load from the blob file, all items have their state set to nothing.
 * If the load mode is not set to incrementalState then we want the items that are in the
 * current merge result to have their state be TOUCHED.
 *
 * This will allow the first use of {@link #mergeData(MergeConsumer, boolean)} to add these
 * to the consumer as if they were new items.
 *
 * @see #loadFromBlob(File, boolean)
 * @see DataItem#isTouched()
 */
private void setPostBlobLoadStateToTouched() {
    ListMultimap<String, I> itemMap = ArrayListMultimap.create();

    // put all the sets into list per keys. The order is important as the lower sets are
    // overridden by the higher sets.
    for (S dataSet : mDataSets) {
        ListMultimap<String, I> map = dataSet.getDataMap();
        for (Map.Entry<String, Collection<I>> entry : map.asMap().entrySet()) {
            itemMap.putAll(entry.getKey(), entry.getValue());
        }
    }

    // the items that represent the current state is the last item in the list for each key.
    for (String key : itemMap.keySet()) {
        List<I> itemList = itemMap.get(key);
        itemList.get(itemList.size() - 1).resetStatusToTouched();
    }
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:32,代碼來源:DataMerger.java

示例5: getConfiguredValue

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Nullable
public ResourceValue getConfiguredValue(
        @NonNull ResourceType type,
        @NonNull String name,
        @NonNull FolderConfiguration referenceConfig) {
    // get the resource item for the given type
    ListMultimap<String, ResourceItem> items = getMap(type, false);
    if (items == null) {
        return null;
    }

    List<ResourceItem> keyItems = items.get(name);
    if (keyItems == null) {
        return null;
    }

    // look for the best match for the given configuration
    // the match has to be of type ResourceFile since that's what the input list contains
    ResourceItem match = (ResourceItem) referenceConfig.findMatchingConfigurable(keyItems);
    return match != null ? match.getResourceValue(mFramework) : null;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:22,代碼來源:AbstractResourceRepository.java

示例6: maakStamgegevenTabellen

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private List<StamgegevenTabel> maakStamgegevenTabellen() {
    final ListMultimap<Integer, AttribuutElement> attribuutMultimap = maakLookupMap();
    final List<StamgegevenTabel> tabellen = new ArrayList<>();
    for (Integer stamtabelObjectId : attribuutMultimap.keySet()) {
        final ObjectElement objectElement = ElementHelper.getObjectElement(stamtabelObjectId);
        final List<AttribuutElement> stamgegevenAttributenInBericht = new ArrayList<>();
        final List<AttribuutElement> stamgegevenAttributen = new ArrayList<>();
        final List<AttribuutElement> attribuutElements = attribuutMultimap.get(stamtabelObjectId);
        for (AttribuutElement attribuutElement : attribuutElements) {
            voegAttributenToe(stamgegevenAttributenInBericht, stamgegevenAttributen, attribuutElement);
        }
        if (stamgegevenAttributen.isEmpty()) {
            continue;
        }
        stamgegevenAttributenInBericht.sort(Comparator.comparingInt(ElementObject::getVolgnummer));

        final StamgegevenTabel stamgegevenTabel = new StamgegevenTabel(objectElement, stamgegevenAttributenInBericht, stamgegevenAttributen);
        tabellen.add(stamgegevenTabel);
    }
    return tabellen;
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:22,代碼來源:StamTabelCacheImpl.java

示例7: verifyAssignments

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private static final void verifyAssignments(ListMultimap<Integer, CompleteWork> assignments,
    List<NodeEndpoint> inputEps, List<CompleteWork> inputWorks) {
  final String summary = summary(assignments, inputEps, inputWorks);
  final Set<CompleteWork> assignedSet = Sets.newHashSet(assignments.values());
  for(CompleteWork cw : inputWorks) {
    assertTrue("Input work not present in assigned work unit list: " + summary,
        assignedSet.contains(cw));
    assertTrue(summary, assignedSet.remove(cw));
  }

  assertTrue("There are some extra works in assigned work unit list: " + summary, assignedSet.size() == 0);

  int i = 0;
  HashSet<CompleteWork> inputWorkSet = new HashSet<>(inputWorks);
  for(NodeEndpoint ep : inputEps) {
    Collection<CompleteWork> assignedWorks = assignments.get(i);
    for(CompleteWork assignedWork : assignedWorks) {
      assertEquals("Wrong endpoint assigned: " + summary,
          ep.getAddress(), assignedWork.getAffinity().get(0).getEndpoint().getAddress());
      assertTrue(summary, inputWorkSet.remove(assignedWork));
    }
    i++;
  }

}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:26,代碼來源:TestHardAssignmentCreator.java

示例8: checkDuplicateForPath

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private static void checkDuplicateForPath(ListMultimap<String, LocalJava> index, String path, List<String> errors) {
    List<LocalJava> localJavas = index.get(path);
    if (localJavas.size() > 1) {
        errors.add(String.format("   - %s are both pointing to the same JDK installation path: %s",
            Joiner.on(", ").join(Iterables.transform(localJavas, new Function<LocalJava, String>() {
                @Override
                public String apply(LocalJava input) {
                    return "'" + input.getName() + "'";
                }
            })), path));
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:JvmComponentPlugin.java

示例9: createActiveRules

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private ActiveRules createActiveRules() {
  ActiveRulesBuilder builder = new ActiveRulesBuilder();

  ListMultimap<String, RulesProfile> profilesByLanguage = profilesByLanguage(profileDefinitions);
  for (String language : profilesByLanguage.keySet()) {
    List<RulesProfile> defs = profilesByLanguage.get(language);
    registerProfilesForLanguage(builder, language, defs);
  }

  for (Repository repo : ruleDefsLoader.getContext().repositories()) {
    for (Rule rule : repo.rules()) {
      if (rule.activatedByDefault()) {
        NewActiveRule newAr = builder.create(RuleKey.of(repo.key(), rule.key()))
          .setLanguage(repo.language())
          .setName(rule.name())
          .setSeverity(rule.severity())
          .setInternalKey(rule.internalKey());
        for (Param param : rule.params()) {
          newAr.setParam(param.key(), param.defaultValue());
        }
        try {
          // TODO the Java plugin tries to add some rules twice... (for example squid:S2093)
          newAr.activate();
        } catch (IllegalStateException e) {
          if (!e.getMessage().contains("is already activated")) {
            throw new IllegalStateException(e);
          }
        }
      }
    }
  }

  return builder.build();
}
 
開發者ID:instalint-org,項目名稱:instalint,代碼行數:35,代碼來源:StandaloneActiveRulesProvider.java

示例10: serializeAcls

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
protected SB serializeAcls()
{
	if( aclManager.filterNonGrantedPrivileges("VIEW_SECURITY_TREE", "EDIT_SECURITY_TREE").isEmpty() )
	{
		throw new AccessDeniedException(getString("error.acls.viewpriv"));
	}

	Node[] allNodes = getAllNodes();
	ListMultimap<String, AccessEntry> entries = aclManager.getExistingEntriesForVirtualNodes(allNodes);
	SB securityBean = createAllSecurityBean();

	List<AccessEntry> list = entries.get(aclManager.getKeyForVirtualNode(allNodes[0], null));

	List<TargetListEntryBean> entryBeans = Lists.newLinkedList();
	for( AccessEntry accessEntry : list )
	{
		TargetListEntryBean entryBean = new TargetListEntryBean();
		entryBean.setGranted(accessEntry.isGrantRevoke() == SecurityConstants.GRANT);
		entryBean.setWho(accessEntry.getExpression().getExpression());
		entryBean.setPrivilege(accessEntry.getPrivilege());
		entryBean.setOverride(accessEntry.getAclPriority() > 0);
		entryBeans.add(entryBean);
	}

	securityBean.setRules(entryBeans);
	return securityBean;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:28,代碼來源:AbstractBaseEntityResource.java

示例11: getResourceItem

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Nullable
public List<ResourceItem> getResourceItem(@NonNull ResourceType resourceType,
        @NonNull String resourceName) {
    synchronized (ITEM_MAP_LOCK) {
        ListMultimap<String, ResourceItem> map = getMap(resourceType, false);

        if (map != null) {
            return map.get(resourceName);
        }
    }

    return null;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:14,代碼來源:AbstractResourceRepository.java

示例12: hasResourceItem

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
/**
 * Returns true if this resource repository contains a resource of the given
 * name.
 *
 * @param resourceType the type of resource to look up
 * @param resourceName the name of the resource
 * @return true if the resource is known
 */
public boolean hasResourceItem(@NonNull ResourceType resourceType,
        @NonNull String resourceName) {
    synchronized (ITEM_MAP_LOCK) {
        ListMultimap<String, ResourceItem> map = getMap(resourceType, false);

        if (map != null) {
            List<ResourceItem> itemList = map.get(resourceName);
            return itemList != null && !itemList.isEmpty();
        }
    }

    return false;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:22,代碼來源:AbstractResourceRepository.java

示例13: getConfiguredResources

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@NonNull
public Map<String, ResourceValue> getConfiguredResources(
        @NonNull Map<ResourceType, ListMultimap<String, ResourceItem>> itemMap,
        @NonNull ResourceType type,
        @NonNull FolderConfiguration referenceConfig) {
    // get the resource item for the given type
    ListMultimap<String, ResourceItem> items = itemMap.get(type);
    if (items == null) {
        return Maps.newHashMap();
    }

    Set<String> keys = items.keySet();

    // create the map
    Map<String, ResourceValue> map = Maps.newHashMapWithExpectedSize(keys.size());

    for (String key : keys) {
        List<ResourceItem> keyItems = items.get(key);

        // look for the best match for the given configuration
        // the match has to be of type ResourceFile since that's what the input list contains
        ResourceItem match = (ResourceItem) referenceConfig.findMatchingConfigurable(keyItems);
        if (match != null) {
            ResourceValue value = match.getResourceValue(mFramework);
            if (value != null) {
                map.put(match.getName(), value);
            }
        }
    }

    return map;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:33,代碼來源:AbstractResourceRepository.java

示例14: visitGroupScan

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public PhysicalOperator visitGroupScan(@SuppressWarnings("rawtypes") GroupScan groupScan, IndexedFragmentNode iNode) throws ExecutionSetupException {
  ListMultimap<Integer, CompleteWork> splits = splitSets.get(groupScan);
  Preconditions.checkNotNull(splits);
  List<CompleteWork> work = splits.get(iNode.getMinorFragmentId());
  Preconditions.checkNotNull(work);
  PhysicalOperator child = groupScan.getSpecificScan(work);
  child.setOperatorId(Short.MAX_VALUE & groupScan.getOperatorId());
  iNode.addAllocation(groupScan);
  child.setCost(groupScan.getCost());

  return child;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:15,代碼來源:Materializer.java

示例15: getCellPermissionsForUser

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
public static List<Permission> getCellPermissionsForUser(User user, Cell cell)
    throws IOException {
  // Save an object allocation where we can
  if (cell.getTagsLength() == 0) {
    return null;
  }
  List<Permission> results = Lists.newArrayList();
  Iterator<Tag> tagsIterator = CellUtil.tagsIterator(cell.getTagsArray(), cell.getTagsOffset(),
     cell.getTagsLength());
  while (tagsIterator.hasNext()) {
    Tag tag = tagsIterator.next();
    if (tag.getType() == ACL_TAG_TYPE) {
      // Deserialize the table permissions from the KV
      // TODO: This can be improved. Don't build UsersAndPermissions just to unpack it again,
      // use the builder
      AccessControlProtos.UsersAndPermissions.Builder builder = 
        AccessControlProtos.UsersAndPermissions.newBuilder();
      ProtobufUtil.mergeFrom(builder, tag.getBuffer(), tag.getTagOffset(), tag.getTagLength());
      ListMultimap<String,Permission> kvPerms =
        ProtobufUtil.toUsersAndPermissions(builder.build());
      // Are there permissions for this user?
      List<Permission> userPerms = kvPerms.get(user.getShortName());
      if (userPerms != null) {
        results.addAll(userPerms);
      }
      // Are there permissions for any of the groups this user belongs to?
      String groupNames[] = user.getGroupNames();
      if (groupNames != null) {
        for (String group : groupNames) {
          List<Permission> groupPerms = kvPerms.get(AuthUtil.toGroupEntry(group));
          if (results != null) {
            results.addAll(groupPerms);
          }
        }
      }
    }
  }
  return results;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:40,代碼來源:AccessControlLists.java


注:本文中的com.google.common.collect.ListMultimap.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。