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


Java ImmutableMultiset.entrySet方法代碼示例

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


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

示例1: identifyDuplicates

import com.google.common.collect.ImmutableMultiset; //導入方法依賴的package包/類
private void identifyDuplicates(List<ModContainer> mods)
{
    TreeMultimap<ModContainer, File> dupsearch = TreeMultimap.create(new ModIdComparator(), Ordering.arbitrary());
    for (ModContainer mc : mods)
    {
        if (mc.getSource() != null)
        {
            dupsearch.put(mc, mc.getSource());
        }
    }

    ImmutableMultiset<ModContainer> duplist = Multisets.copyHighestCountFirst(dupsearch.keys());
    SetMultimap<ModContainer, File> dupes = LinkedHashMultimap.create();
    for (Entry<ModContainer> e : duplist.entrySet())
    {
        if (e.getCount() > 1)
        {
            FMLLog.severe("Found a duplicate mod %s at %s", e.getElement().getModId(), dupsearch.get(e.getElement()));
            dupes.putAll(e.getElement(),dupsearch.get(e.getElement()));
        }
    }
    if (!dupes.isEmpty())
    {
        throw new DuplicateModsFoundException(dupes);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:Loader.java

示例2: determinePayOutPercentage

import com.google.common.collect.ImmutableMultiset; //導入方法依賴的package包/類
/**
 * Method should return the number of times an occurrence of a reel
 * 
 * @param reels
 * @return
 */
static int determinePayOutPercentage(List<String> reels) {

	Multiset<String> reelCount = HashMultiset.create();
	reelCount.addAll(reels);

	// order the number of elements by the higest
	ImmutableMultiset<String> highestCountFirst = Multisets.copyHighestCountFirst(reelCount);

	int count = 0;
	for (Entry<String> entry : highestCountFirst.entrySet()) {
		count = entry.getCount();
		break;
	}
	return count;
}
 
開發者ID:leveluplunch,項目名稱:levelup-java-exercises,代碼行數:22,代碼來源:SlotMachineSimulation.java

示例3: writePropertiesFile

import com.google.common.collect.ImmutableMultiset; //導入方法依賴的package包/類
static void writePropertiesFile(Scenario scen,
    GeneratorSettings settings, double actualDyn, long seed,
    String fileName) {
  final DateTimeFormatter formatter = ISODateTimeFormat
    .dateHourMinuteSecondMillis();

  final VanLon15ProblemClass pc = (VanLon15ProblemClass) scen
    .getProblemClass();
  final ImmutableMap.Builder<String, Object> properties = ImmutableMap
    .<String, Object>builder()
    .put("problem_class", pc.getId())
    .put("id", scen.getProblemInstanceId())
    .put("dynamism_bin", pc.getDynamism())
    .put("dynamism_actual", actualDyn)
    .put("urgency", pc.getUrgency())
    .put("scale", pc.getScale())
    .put("random_seed", seed)
    .put("creation_date", formatter.print(System.currentTimeMillis()))
    .put("creator", System.getProperty("user.name"))
    .put("day_length", settings.getDayLength())
    .put("office_opening_hours", settings.getOfficeHours());

  properties.putAll(settings.getProperties());

  final ImmutableMultiset<Class<?>> eventTypes = Metrics
    .getEventTypeCounts(scen);
  for (final Multiset.Entry<Class<?>> en : eventTypes.entrySet()) {
    properties.put(en.getElement().getSimpleName(), en.getCount());
  }

  try {
    Files.write(
      Paths.get(fileName + ".properties"),
      asList(Joiner.on("\n").withKeyValueSeparator(" = ")
        .join(properties.build())),
      Charsets.UTF_8);
  } catch (final IOException e) {
    throw new IllegalStateException(e);
  }
}
 
開發者ID:rinde,項目名稱:pdptw-dataset-generator,代碼行數:41,代碼來源:DatasetGenerator.java


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