本文整理汇总了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);
}
}
示例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;
}
示例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);
}
}