当前位置: 首页>>代码示例>>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;未经允许,请勿转载。