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


Java ListMultimap.keySet方法代碼示例

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


在下文中一共展示了ListMultimap.keySet方法的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: 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

示例6: validateNoDuplicate

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private static void validateNoDuplicate(ModelMap<LocalJava> jdks) {
    ListMultimap<String, LocalJava> jdksByPath = indexByPath(jdks);
    List<String> errors = Lists.newArrayList();
    for (String path : jdksByPath.keySet()) {
        checkDuplicateForPath(jdksByPath, path, errors);
    }
    if (!errors.isEmpty()) {
        throw new InvalidModelException(String.format("Duplicate Java installation found:\n%s", Joiner.on("\n").join(errors)));
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:11,代碼來源:JvmComponentPlugin.java

示例7: printKeywordsInTypesButNotInN4JS

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
private void printKeywordsInTypesButNotInN4JS() {
	Grammar n4js = grammarAccess.getGrammar();
	Grammar types = typesGrammarAccess.getGrammar();
	ListMultimap<String, Keyword> n4jsKeywords = getAllKeywords(n4js);
	ListMultimap<String, Keyword> typesKeywords = getAllKeywords(types);

	typesKeywords.keySet().removeAll(n4jsKeywords.keySet());

	System.out.println("Keywords which do not occur in n4js rules: ");
	for (String keyword : typesKeywords.keySet()) {
		System.out.println("  " + keyword);
	}
	System.out.println();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:GrammarLinter.java

示例8: getData

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
public void getData(List<String> metricStrings, int startTimeSeconds, int endTimeSeconds,
                    PrintWriter writer) throws Exception {

    JsonWriter jsonWriter = new JsonWriter(writer);
    ListMultimap<String, MetricName> functionToMetrics = getFunctionToMetrics(metricStrings);


    jsonWriter.beginObject();
    for (String function : functionToMetrics.keySet()) {
        appendData(functionToMetrics.get(function), function, startTimeSeconds, endTimeSeconds, jsonWriter);
    }
    jsonWriter.endObject();
}
 
開發者ID:yandex,項目名稱:graphouse,代碼行數:14,代碼來源:MetricDataService.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: performAdditionalQueries

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
@Override
public void performAdditionalQueries(ItemSerializerState state)
{
	if( state.hasCategory(CATEGORY_NAVIGATION) )
	{
		ListMultimap<Long, ItemNavigationNode> nodes = itemDao
			.getNavigationNodesForItemIds(state.getItemIdsWithPrivilege(ItemSecurityConstants.VIEW_ITEM));
		for( Long itemId : nodes.keySet() )
		{
			state.setData(itemId, KEY_NAVIGATION_NODES, nodes.get(itemId));
		}
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:14,代碼來源:NavigationNodeSerializerProvider.java

示例11: 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

示例12: writePermissions

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
/**
 * Writes a set of permissions as {@link org.apache.hadoop.io.Writable} instances
 * to the given output stream.
 * @param out
 * @param perms
 * @param conf
 * @throws IOException
*/
public static void writePermissions(DataOutput out,
    ListMultimap<String,? extends Permission> perms, Configuration conf)
throws IOException {
  Set<String> keys = perms.keySet();
  out.writeInt(keys.size());
  for (String key : keys) {
    Text.writeString(out, key);
    HbaseObjectWritableFor96Migration.writeObject(out, perms.get(key), List.class, conf);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:19,代碼來源:TestTablePermissions.java

示例13: checkMultimapEqual

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
public void checkMultimapEqual(ListMultimap<String,TablePermission> first,
    ListMultimap<String,TablePermission> second) {
  assertEquals(first.size(), second.size());
  for (String key : first.keySet()) {
    List<TablePermission> firstPerms = first.get(key);
    List<TablePermission> secondPerms = second.get(key);
    assertNotNull(secondPerms);
    assertEquals(firstPerms.size(), secondPerms.size());
    LOG.info("First permissions: "+firstPerms.toString());
    LOG.info("Second permissions: "+secondPerms.toString());
    for (TablePermission p : firstPerms) {
      assertTrue("Permission "+p.toString()+" not found", secondPerms.contains(p));
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:TestTablePermissions.java

示例14: print

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
public void print(StyledTextOutput output) {
    final List<Task> tasks = sort(selection.getTasks());

    output.text("Detailed task information for ").withStyle(UserInput).println(taskPath);
    final ListMultimap<Class, Task> classListMap = groupTasksByType(tasks);

    final Set<Class> classes = classListMap.keySet();
    boolean multipleClasses = classes.size() > 1;
    final List<Class> sortedClasses = sort(classes, new Comparator<Class>() {
        public int compare(Class o1, Class o2) {
            return o1.getSimpleName().compareTo(o2.getSimpleName());
        }
    });
    for (Class clazz : sortedClasses) {
        output.println();
        final List<Task> tasksByType = classListMap.get(clazz);
        final LinePrefixingStyledTextOutput pathOutput = createIndentedOutput(output, INDENT);
        pathOutput.println(tasksByType.size() > 1 ? "Paths" : "Path");
        for (Task task : tasksByType) {
            pathOutput.withStyle(UserInput).println(task.getPath());
        }

        output.println();
        final LinePrefixingStyledTextOutput typeOutput = createIndentedOutput(output, INDENT);
        typeOutput.println("Type");
        typeOutput.withStyle(UserInput).text(clazz.getSimpleName());
        typeOutput.println(" (" + clazz.getName() + ")");

        printlnCommandlineOptions(output, tasksByType);

        output.println();
        printTaskDescription(output, tasksByType);

        output.println();
        printTaskGroup(output, tasksByType);

        if (multipleClasses) {
            output.println();
            output.println("----------------------");
        }
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:43,代碼來源:TaskDetailPrinter.java

示例15: groupByTypeAndTag

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
protected List<DataPointGroup> groupByTypeAndTag(String metricName,
		List<DataPointRow> rows, TagGroupBy tagGroupBy, Order order)
{
	List<DataPointGroup> ret = new ArrayList<DataPointGroup>();
	MemoryMonitor mm = new MemoryMonitor(20);

	if (rows.isEmpty())
	{
		ret.add(new SortingDataPointGroup(metricName, order));
	}
	else
	{
		ListMultimap<String, DataPointGroup> typeGroups = ArrayListMultimap.create();

		//Go through each row grouping them by type
		for (DataPointRow row : rows)
		{
			String groupType = m_dataPointFactory.getGroupType(row.getDatastoreType());

			typeGroups.put(groupType, new DataPointGroupRowWrapper(row));
			mm.checkMemoryAndThrowException();
		}

		//Sort the types for predictable results
		TreeSet<String> sortedTypes = new TreeSet<String>(typeGroups.keySet());

		//Now go through each type group and group by tag if needed.
		for (String type : sortedTypes)
		{
			if (tagGroupBy != null)
			{
				ListMultimap<String, DataPointGroup> groups = ArrayListMultimap.create();
				Map<String, TagGroupByResult> groupByResults = new HashMap<String, TagGroupByResult>();

				for (DataPointGroup dataPointGroup : typeGroups.get(type))
				{
					//Todo: Add code to datastore implementations to filter by the group by tag

					LinkedHashMap<String, String> matchingTags = getMatchingTags(dataPointGroup, tagGroupBy.getTagNames());
					String tagsKey = getTagsKey(matchingTags);
					groups.put(tagsKey, dataPointGroup);
					groupByResults.put(tagsKey, new TagGroupByResult(tagGroupBy, matchingTags));
					mm.checkMemoryAndThrowException();
				}

				//Sort groups by tags
				TreeSet<String> sortedGroups = new TreeSet<String>(groups.keySet());

				for (String key : sortedGroups)
				{
					SortingDataPointGroup sdpGroup = new SortingDataPointGroup(groups.get(key), groupByResults.get(key), order);
					sdpGroup.addGroupByResult(new TypeGroupByResult(type));
					ret.add(sdpGroup);
				}
			}
			else
			{
				ret.add(new SortingDataPointGroup(typeGroups.get(type), new TypeGroupByResult(type), order));
			}
		}
	}

	return ret;
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:65,代碼來源:KairosDatastore.java


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